Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (38 sloc) 914 Bytes
import string
import sys
from collections import OrderedDict
comp={'A':'T','T':'A','G':'C','C':'G'}
value,key="",""
s=OrderedDict({})
with open("rosalind_splc.txt","rU") as f:
for x in f:
if x[0]!=">":
value=value+x.strip()
else:
if key!="":
s[key]=value
value=""
key=x[1:].strip()
s[key]=value
f.close()
rna={}
f=open('rna_table.txt','rU')
for line in f:
x=line.split()
codons=x[0::2]
acids=x[1::2]
rna_new=dict(zip(codons,acids))
rna.update(rna_new)
f.close()
dna=s.values()[0]
for value in s.values()[1:]:
while value in dna:
j=dna.find(value)
t=len(value)
dna=dna[0:j]+dna[j+t:]
dna=dna.replace("T","U")
for i in range(0,len(dna),3):
if rna[dna[i:i+3]]=='Stop':
sys.stdout.write('\n')
break
sys.stdout.write(rna[dna[i:i+3]]),
You can’t perform that action at this time.