Open main menu

Biolecture.org β

Minsu Kim/python/Rosalind / problem7

 

f = open('rosalind_ba1h.txt', 'r') 
lines = f.readlines()
f.close()

pattern = lines[0].strip()
seq = lines[1].strip()
d = int(lines[2])

solution = open('solution.txt','w')


for i in range(len(seq)-len(pattern)+1):
    count = 0
    for j in range(len(pattern)):
        if seq[i+j]!=pattern[j]:
            count += 1
    if count <= d:
        solution.write(str(i))
        solution.write("\n")
        
solution.close