Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint64_t find_all_regex1(char * str) {//"agggtaaa|tttaccct"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) { if((a = strstr(a, "agggtaaa"))) ++count, a += 8; else state &= 0x1;}
- if(b) { if((b = strstr(b, "tttaccct"))) ++count, b += 8; else state &= 0x2;}
- } while(state);
- return count;
- }
- uint64_t find_all_regex2(char * str) {//"[cgt]gggtaaa|tttaccc[acg]"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "gggtaaa"))) {
- switch(*(a - 1)) {
- case 'c': case 'g': case 't': ++count;
- default: a += 7; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "tttaccc"))) {
- switch(*(b + 7)) {
- case 'a': case 'c': case 'g': ++count, b += 1;
- default: b += 7; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex3(char * str) {//"a[act]ggtaaa|tttacc[agt]t"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "ggtaaa"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 't': if(*(a - 2) == 'a') ++count;
- default: a += 6; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "tttacc"))) {
- switch(*(b + 6)) {
- case 'a': case 'g': case 't': if(*(b + 7) == 't') ++count, b += 2;
- default: b += 6; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex4(char * str) {//"ag[act]gtaaa|tttac[agt]ct"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "gtaaa"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 't': if(!memcmp(a - 3, "ag", 2)) ++count;
- default: a += 5; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "tttac"))) {
- switch(*(b + 5)) {
- case 'a': case 'g': case 't': if(!memcmp(b + 6, "ct", 2)) ++count, b += 3;
- default: b += 5; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex5(char * str) {//"agg[act]taaa|ttta[agt]cct"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "taaa"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 't': if(!memcmp(a - 4, "agg", 3)) ++count;
- default: a += 4; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "ttta"))) {
- switch(*(b + 4)) {
- case 'a': case 'g': case 't': if(!memcmp(b + 5, "cct", 3)) ++count, b += 4;
- default: b += 4; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex6(char * str) {//"ttt[cgt]ccct|aggg[acg]aaa"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "ccct"))) {
- switch(*(a - 1)) {
- case 'c': case 'g': case 't': if(!memcmp(a - 4, "ttt", 3)) ++count;
- default: a += 4; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "aggg"))) {
- switch(*(b + 4)) {
- case 'a': case 'c': case 'g': if(!memcmp(b + 5, "aaa", 3)) ++count, b += 4;
- default: b += 4; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex7(char * str) {//"tt[acg]accct|agggt[cgt]aa"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "accct"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 'g': if(!memcmp(a - 3, "tt", 2)) ++count;
- default: a += 5; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "agggt"))) {
- switch(*(b + 5)) {
- case 'c': case 'g': case 't': if(!memcmp(b + 6, "aa", 2)) ++count, b += 3;
- default: b += 5; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex8(char * str) {//"t[acg]taccct|agggta[cgt]a"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "taccct"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 'g': if(!memcmp(a - 2, "t", 1)) ++count;
- default: a += 6; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "agggta"))) {
- switch(*(b + 6)) {
- case 'c': case 'g': case 't': if(!memcmp(b + 7, "a", 1)) ++count, b += 2;
- default: b += 6; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
- uint64_t find_all_regex9(char * str) {//"[acg]ttaccct|agggtaa[cgt]"
- uint64_t count = 0;
- char * a = str, * b = str;
- uint64_t state = 0x3;
- do {
- if(a) {
- if((a = strstr(a, "ttaccct"))) {
- switch(*(a - 1)) {
- case 'a': case 'c': case 'g': ++count;
- default: a += 7; break;
- }
- } else state &= 0x1;
- }
- if(b) {
- if((b = strstr(b, "agggtaa"))) {
- switch(*(b + 7)) {
- case 'c': case 'g': case 't': ++count, b += 1;
- default: b += 7; break;
- }
- } else state &= 0x2;
- }
- } while(state);
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment