-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTranslatingRNAintoProtein.py
33 lines (31 loc) · 10.8 KB
/
TranslatingRNAintoProtein.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
RNA_CODON_TABLE = {
"UUU":"F", "UUC":"F", "UUA":"L", "UUG":"L",
"UCU":"S", "UCC":"S", "UCA":"S", "UCG":"S",
"UAU":"Y", "UAC":"Y", "UAA":"STOP", "UAG":"STOP",
"UGU":"C", "UGC":"C", "UGA":"STOP", "UGG":"W",
"CUU":"L", "CUC":"L", "CUA":"L", "CUG":"L",
"CCU":"P", "CCC":"P", "CCA":"P", "CCG":"P",
"CAU":"H", "CAC":"H", "CAA":"Q", "CAG":"Q",
"CGU":"R", "CGC":"R", "CGA":"R", "CGG":"R",
"AUU":"I", "AUC":"I", "AUA":"I", "AUG":"M",
"ACU":"T", "ACC":"T", "ACA":"T", "ACG":"T",
"AAU":"N", "AAC":"N", "AAA":"K", "AAG":"K",
"AGU":"S", "AGC":"S", "AGA":"R", "AGG":"R",
"GUU":"V", "GUC":"V", "GUA":"V", "GUG":"V",
"GCU":"A", "GCC":"A", "GCA":"A", "GCG":"A",
"GAU":"D", "GAC":"D", "GAA":"E", "GAG":"E",
"GGU":"G", "GGC":"G", "GGA":"G", "GGG":"G",}
def replaceCodons(rnasequence):
i = 0
protein = ""
rnasequence = rnasequence.replace("\n","")
while (i < len(rnasequence)):
if(RNA_CODON_TABLE[rnasequence[i:i+3]]== 'STOP'):
break
protein += RNA_CODON_TABLE[rnasequence[i:i + 3]]
i += 3
protein = protein.replace('STOP','')
print(protein)
inputRNA = 'AUGGGUGUCCAGAAAGGCUUGGACUUGGACUUGCGAUCGGCAGGCAAUUUGACCAUAAGACACCGAAUAACUUUGUCAUCGGCUGGACAAGCCUGUGGUAGCCGGAAGGUUCGGACUCACAGAAAGGAGCGUAGUGUAAUUUUUAGGGCGGUAGUAACGCGUGAC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