3faf91c30c46e8c55a6644ba75c8f682724e6a0a
5 int main(int argc
, char* argv
[])
10 long long unsigned int occs
= 0;
11 /* When the filepath is not given or "-" assume stdin */
12 FILE *f
= (argc
!=2 || strcmp(argv
[1], "-")==0) ? stdin
: fopen(argv
[1], "r");
15 printf("Unable to open file or stdin...\n");
18 while((c
= fgetc(f
)) != EOF
)
20 if(c
== '\n' && charsperline
== 100 && numlines
<= 500)
25 else if((c
== 'A' || c
=='C' || c
=='G' || c
=='T') && charsperline
< 100)
26 { /*Fancy polynomial that translates the ascii value to a bitshift*/
27 occs
+= 1LL<<(int)(0.026514*c
*c
*c
-6.049*c
*c
+459.96*c
-11621.2);
37 printf("A: %llu\nC: %llu\nG: %llu\nT: %llu\n", occs
& 0xFFFF,
38 (occs
>> 16) & 0xFFFF, (occs
>> 32) & 0xFFFF, (occs
>> 48) & 0xFFFF);