haiferry的个人博客分享 http://blog.sciencenet.cn/u/haiferry

博文

Translating RNA into Protein

已有 1820 次阅读 2015-11-9 13:31 |系统分类:科研笔记

Translating RNA into Protein  

Problem

The 20 commonly occurring amino acids areabbreviated by using 20 letters from the English alphabet (all lettersexcept for B, J, O, U, X, and Z). Protein strings areconstructed from these 20 symbols. Henceforth, the term genetic string willincorporate protein strings along with DNA strings and RNA strings.

The RNA codon table dictatesthe details regarding the encoding of specific codons into the amino acidalphabet.

Given: An RNA string s correspondingto a strand of mRNA (of length at most 10 kbp).

Return: Theprotein string encoded by s.

Sample Dataset

AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA

Sample Output

MAMAPRTEINSTRING

针对以上案例,我采用了以下代码解决:

#!/usr/bin/python

s='AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA'

map = {"UUU":"F","UUC":"F", "UUA":"L","UUG":"L",

     "UCU":"S", "UCC":"S","UCA":"S", "UCG":"S",

     "UAU":"Y","UAC":"Y","UGU":"C","UGC":"C",

     "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",

     "UAA":"*","UAG":"*","UGA":"*"}

i=0

pro=''

for i in range(0, len(s), 3):

pro=pro+map[s[i:i+3]]

i+=1

print pro




https://wap.sciencenet.cn/blog-2887147-934403.html

上一篇:Counting Point Mutations
下一篇:python 处理文本
收藏 IP: 159.226.67.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-30 12:23

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部