defTranslate_rna (sequence):#Password sub-tableCodontable = { 'AUA':'I','AUC':'I','AUU':'I',' the':'M', 'ACA':'T','ACC':'T','ACG':'T','ACU':'T', 'AAC':'N','AAU':'N','AAA':'K','AAG':'K', 'AGC':'S','AGU':'S','AGA':'R','AGG':'R', 'CUA':'L','CUC':'L','CUG':'L','Cuu':'L', 'CCA':'P','CCC':'P','CCG':'P','CCU':'P', 'CAC':'H','CAU':'H','CAA':'Q','CAG':'Q', 'CGA':'R','CGC':'R','CGG':'R','CGU':'R', 'GUA':'V','GUC':'V','GUG':'V','GUU':'V', 'GCA':'A','GCC':'A','GCG':'A','GCU':'A', 'GAC':'D','GAU':'D','GAA':'E','GAG':'E', 'GGA':'G','GGC':'G','GGG':'G','Ggu':'G', 'UCA':'S','UCC':'S','UCG':'S','UCU':'S', 'Uuc':'F','UUU':'F','UUA':'L','Uug':'L', 'UAC':'Y','Uau':'Y','UAA':"','UAG':"', 'UGC':'C','Ugu':'C','UGA':"','UGG':'W',} proteinsequence="' # 3 x 3 take forNinchRange (0, Len (sequence), 3): If sequence[n:n + 3] in codontable.keys (): #Add the key value of the matching dictionary to the protein character channelingProteinsequence + = codontable[sequence[n:n + 3]] returnProteinsequencese="Auggccauggcgcccagaacugagaucaauaguacccguauuaacggguga" #sequencePrint(Translate_rna (SE)) mamaprteinstring
Python text processing to convert RNA to protein