Minsu Kim/python/Rosalind / problem12
From Biolecture.org
Revision as of 21:55, 12 December 2017 by imported>Minsukim (Created page with "<p><img alt="" src="/ckfinder/userfiles/images/bandicam%202017-12-12%2021-52-17-307.jpg" style="height:275px; width:860px" /></p> <p> </p> <p>import itertools</p> <p>f = ...")
import itertools
f = open('rosalind_ba1n.txt', 'r')
lines = f.readlines()
seq = lines[0].strip()
d = int(lines[1])
f.close
solution = open('solution3.txt', 'w')
for i in itertools.product("ACGT", repeat=len(seq)):
p = ''.join(i)
count = 0
for k in range(len(p)):
if seq[k] != p[k]:
count += 1
if count > d:
break
if count <= d:
solution.write(p + '\n')
solution.close()