1
+ print ("Please input DNA strand" )
2
+ dna = input ()
3
+
4
+ # RNA codon table
5
+ rna_codon = {"UUU" : "F" , "CUU" : "L" , "AUU" : "I" , "GUU" : "V" ,
6
+ "UUC" : "F" , "CUC" : "L" , "AUC" : "I" , "GUC" : "V" ,
7
+ "UUA" : "L" , "CUA" : "L" , "AUA" : "I" , "GUA" : "V" ,
8
+ "UUG" : "L" , "CUG" : "L" , "AUG" : "M" , "GUG" : "V" ,
9
+ "UCU" : "S" , "CCU" : "P" , "ACU" : "T" , "GCU" : "A" ,
10
+ "UCC" : "S" , "CCC" : "P" , "ACC" : "T" , "GCC" : "A" ,
11
+ "UCA" : "S" , "CCA" : "P" , "ACA" : "T" , "GCA" : "A" ,
12
+ "UCG" : "S" , "CCG" : "P" , "ACG" : "T" , "GCG" : "A" ,
13
+ "UAU" : "Y" , "CAU" : "H" , "AAU" : "N" , "GAU" : "D" ,
14
+ "UAC" : "Y" , "CAC" : "H" , "AAC" : "N" , "GAC" : "D" ,
15
+ "UAA" : "STOP" , "CAA" : "Q" , "AAA" : "K" , "GAA" : "E" ,
16
+ "UAG" : "STOP" , "CAG" : "Q" , "AAG" : "K" , "GAG" : "E" ,
17
+ "UGU" : "C" , "CGU" : "R" , "AGU" : "S" , "GGU" : "G" ,
18
+ "UGC" : "C" , "CGC" : "R" , "AGC" : "S" , "GGC" : "G" ,
19
+ "UGA" : "STOP" , "CGA" : "R" , "AGA" : "R" , "GGA" : "G" ,
20
+ "UGG" : "W" , "CGG" : "R" , "AGG" : "R" , "GGG" : "G"
21
+ }
22
+
23
+ rna = ""
24
+
25
+ for i in dna :
26
+ if i == "T" :
27
+ rna += "U"
28
+ else :
29
+ rna += i
30
+
31
+ print ("RNA strand" , rna )
32
+ print ("Would you like to convert to protein sequence? Yes/No" )
33
+
34
+ def generate_protein ():
35
+ protein_string = ""
36
+
37
+ for i in range (0 , len (rna )- (3 + len (rna )% 3 ), 3 ):
38
+ if rna_codon [rna [i :i + 3 ]] == "STOP" :
39
+ break
40
+ protein_string += rna_codon [rna [i :i + 3 ]]
41
+
42
+ # Print the protein string
43
+ print ( "Protein String: " , protein_string )
44
+
45
+ if input ().lower () == "yes" :
46
+ generate_protein ()
47
+
48
+
49
+ # source: https://towardsdatascience.com/starting-off-in-bioinformatics-rna-transcription-and-translation-aaa7a91db031
0 commit comments