test thing
authorMart Lubbers <mart@martlubbers.net>
Sun, 1 Feb 2015 22:25:54 +0000 (23:25 +0100)
committerMart Lubbers <mart@martlubbers.net>
Sun, 1 Feb 2015 22:25:54 +0000 (23:25 +0100)
ass1/mart/sws1-s4109503-s4202015/exercise2/parsegenome.c

index 3395d89..eee156f 100644 (file)
@@ -25,21 +25,16 @@ int main(int argc, char* argv[])
        {
                if(c == '\n')
                {
-                       if(charsperline != 100)
+                       if(charsperline != 100 || numlines > 500)
                                return -1;
                        numlines += 1;
                        charsperline = 0;
                }
                else
                {
-                       if(c == 'A')
-                               occs[0] += 1;
-                       else if(c == 'C')
-                               occs[1] += 1;
-                       else if(c == 'G')
-                               occs[2] += 1;
-                       else if(c == 'T')
-                               occs[3] += 1;
+/* Fancy polynome that translates A: 0, C: 1, G: 2, T: 3 */
+                       if(c == 'A' || c == 'C' || c == 'G' || c == 'T')
+                               occs[(int)(.001657140781*c*c*c-0.3780662484*c*c+28.74757194*c-726.3545635)] += 1;
                        else
                                return -1;
                        charsperline += 1;