I am trying to compute the most repeated STR for each sequence in a dictionary called str_dict.
# compute STRs
i = 0
# stablish length of the sequence
length_seq = len(sequence)
# iterate through all the possibles strs
for s in strs:
# iterate through the sequence
while i <= length_seq:
if sequence[i:i+len(s)] == s:
counter += 1
# advance len(s) steps
i += len(s)
if counter > str_dict[s]:
str_dict[s] = counter
else:
counter == 0
i += 1
The code should function as intended, but it only computes the first key in the dictionary and the rest still have a value of 0. What am I missing?