编程语言
首页 > 编程语言> > python 中根据RNA序列输出密码子编码的氨基酸序列

python 中根据RNA序列输出密码子编码的氨基酸序列

作者:互联网

 

001、

(base) root@PC1:/home/test4# ls
test.py
(base) root@PC1:/home/test4# cat test.py                       ## 测试程序
#!/usr/bin/python
rna = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA"
table = {
'UUU':'F','CUU':'L','AUU':'I','GUU':'V',
'UUC':'F','CUC':'L','AUC':'I','GUC':'V',
'UUA':'L','CUA':'L','AUA':'I','GUA':'V',
'UUG':'L','CUG':'L','AUG':'M','GUG':'V',
'UCU':'S','CCU':'P','ACU':'T','GCU':'A',
'UCC':'S','CCC':'P','ACC':'T','GCC':'A',
'UCA':'S','CCA':'P','ACA':'T','GCA':'A',
'UCG':'S','CCG':'P','ACG':'T','GCG':'A',
'UAU':'Y','CAU':'H','AAU':'N','GAU':'D',
'UAC':'Y','CAC':'H','AAC':'N','GAC':'D',
'UAA':'Stop','CAA':'Q','AAA':'K','GAA':'E',
'UAG':'Stop','CAG':'Q','AAG':'K','GAG':'E',
'UGU':'C','CGU':'R','AGU':'S','GGU':'G',
'UGC':'C','CGC':'R','AGC':'S','GGC':'G',
'UGA':'Stop','CGA':'R','AGA':'R','GGA':'G',
'UGG':'W','CGG':'R','AGG':'R','GGG':'G'}

result = ""

for i in range(0, len(rna), 3):
    if rna[i:i+3] not in table or table[rna[i:i+3]] == "Stop":
        print("enconter stop!")
        break
    else:
        result += table[rna[i:i+3]]
print(result)

(base) root@PC1:/home/test4# python test.py            ## 执行程序
enconter stop!
MAMAPRTEINSTRING

 

参考:https://blog.csdn.net/weshengxin/article/details/110790253

 

标签:test4,python,密码子,Stop,test,序列,table,rna
来源: https://www.cnblogs.com/liujiaxin2018/p/16596700.html