1

The databases/small.csv file from the distro code looks like this: name,AGATC,AATG,TATC Alice,2,8,3 Bob,4,1,5 Charlie,3,2,5 The file is 57 bytes and dated 21-Oct-2019. Perhaps redownload the distro code. (Or correct the file in your favorite editor).


1

Make it an "fr" string and use a replacement field (string interpolation) as with re.findall(rf'(?:{findme})+', sequence) Where findme is set to the nucleotide to match.


1

The proximate cause of the infinite loop is this while in the repeatss function: while dna_str[j : j + len_str] in str_csv[i]: curr_str += 1 j += len_str In python, if i is greater than len(s) in slice notation (s[i : j]), it returns the empty string (even though s[i] would return index out of range error). From ...


1

If you look at the databases, you'll see that Harry (which your code produces for sequence 18) is almost an exact match with one exception. Sequence 18 contains TCTG 41 times, rather than the 40 times expected for Harry. When you look inside it with a debugger, your code does correctly identify the sequence count of 41, meaning the problem comes when you ...


1

What is the value of i when the function moves on to the next str?


1

Your problem is that the nucleotide loop steps through each letter of the sample, but when you find a match your index variable falls out of sync with the letter you are checking. I generally prefer not to just write code as an answer, but have a look at this variation of your comp_repeats function to see the difference: def comp_repeats(header, sample): ...


Only top voted, non community-wiki answers of a minimum length are eligible