Difference between revisions of "Minsu Kim/python/Rosalind / problem10"
From Biolecture.org
imported>Minsukim (Created page with "<p><img alt="" src="/ckfinder/userfiles/images/bandicam%202017-12-12%2021-33-53-945.jpg" style="height:252px; width:639px" /></p> <p>f = open('rosalind_ba1m.txt','r&...") |
imported>Minsukim |
||
Line 1: | Line 1: | ||
<p><img alt="" src="/ckfinder/userfiles/images/bandicam%202017-12-12%2021-33-53-945.jpg" style="height:252px; width:639px" /></p> | <p><img alt="" src="/ckfinder/userfiles/images/bandicam%202017-12-12%2021-33-53-945.jpg" style="height:252px; width:639px" /></p> | ||
− | <p>f = open(' | + | <p>f = open('rosalind_ba1l.txt','r')<br /> |
− | + | seq = f.readline().strip()<br /> | |
− | |||
f.close</p> | f.close</p> | ||
− | <p>a = | + | <p>a = 0<br /> |
− | for i in range(0, | + | for i in range(0, len(seq)):<br /> |
− | | + | if seq[i] == 'A':<br /> |
− | + | d = 0<br /> | |
− | + | if seq[i] == 'C':<br /> | |
− | + | d = 1<br /> | |
− | + | if seq[i] == 'G':<br /> | |
− | | + | d = 2<br /> |
− | & | + | if seq[i] == 'T':<br /> |
− | | + | d = 3<br /> |
− | + | d = d*(4**(len(seq)-i-1))<br /> | |
− | + | a += d<br /> | |
− | | + | print(a)</p> |
− | | ||
− | | ||
− | | ||
− | print |
Latest revision as of 21:46, 12 December 2017
f = open('rosalind_ba1l.txt','r')
seq = f.readline().strip()
f.close
a = 0
for i in range(0, len(seq)):
if seq[i] == 'A':
d = 0
if seq[i] == 'C':
d = 1
if seq[i] == 'G':
d = 2
if seq[i] == 'T':
d = 3
d = d*(4**(len(seq)-i-1))
a += d
print(a)