def translate_rna(sequence): # 密码子表 codonTable = { ‘AUA‘: ‘I‘, ‘AUC‘: ‘I‘, ‘AUU‘: ‘I‘, ‘AUG‘: ‘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个3个取 for n in range(0, len(sequence), 3): if sequence[n:n + 3] in codonTable.keys(): # 把匹配到的字典的键值加入到蛋白质字符窜 proteinsequence += codonTable[sequence[n:n + 3]] return proteinsequence se = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA" # sequence print(translate_rna(se)) MAMAPRTEINSTRING
时间: 2024-10-13 06:47:17