DNA was a breeze until I got to the part where I have to check the dna sequences for patterns. Regardless of wich file I pass to the program it always detects only 1 repetition for every pattern.
Exemple of how I made my detection functions.
def agatc(s):
maxrep = 0
temp = 0
for i in range(0, len(s) - 4, 1):
if s[i] == "A" and s[i + 1] == "G" and s[i + 2] == "A" and s[i + 3] == "T" and s[i + 4] == "C":
temp += 1
print(i)
i += 3
else:
if temp > maxrep:
maxrep = temp
temp = 0
return maxrep
I though the problem might be in adding 3 to the i
variable, so I added print(i)
to see what was happening. I got the following:
45
1938
2049
2195
2952
2957
2962
2967
2972
2977
2982
2987
2992
2997
3002
3007
3012
3017
3022
3689
4754