Problem

The 20 commonly occurring amino acids are abbreviated by using 20 letters from the English alphabet (all letters except for B, J, O, U, X, and Z). Protein strings are constructed from these 20 symbols. Henceforth, the term genetic string will incorporate protein strings along with DNA strings and RNA strings.

The RNA codon table dictates the details regarding the encoding of specific codons into the amino acid alphabet.

Given: An RNA string ss corresponding to a strand of mRNA (of length at most 10 kbp).

Return: The protein string encoded by ss.

Sample Dataset

AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA

Sample Output

MAMAPRTEINSTRING

方法一:
# -*- coding: utf-8 -*-
### 8. Translating RNA into Protein ###
import re
from collections import OrderedDict codonTable = OrderedDict()
with open('rna_codon_table.txt') as f:
for line in f:
line = line.rstrip()
lst = re.split('\s+', line) #\s+ 匹配空格1次或无限次
for i in [0, 2, 4, 6]:
codonTable[lst[i]] = lst[i + 1] rnaSeq = ''
with open('rosalind_prot.txt', 'rt') as f:
for line in f:
line = line.rstrip()
rnaSeq += line.upper() aminoAcids = []
i = 0
while i < len(rnaSeq):
codon = rnaSeq[i:i + 3]
if codonTable[codon] != 'Stop':
aminoAcids.append(codonTable[codon])
i += 3 peptide = ''.join(aminoAcids) print (peptide)
方法二:
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 = ''
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 = open('rosalind_prot.txt').read().strip('\n') #sequence

方法三:

from Bio.Seq import Seq
from Bio.Alphabet import generic_dna, generic_rna # translation
messenger_rna = Seq("AUGGCCAUUGUAAUGGGCCGCUGAAAGGGUGCCCGAUAG", generic_rna)
messenger_rna.translate() # reverse complement
my_dna = Seq("AGTACACTGGT", generic_dna)
my_dna.reverse_complement()

  

08 Translating RNA into Protein的更多相关文章

  1. The top 100 papers Nature explores the most-cited research of all time.

    The top 100 papers Nature explores the most-cited research of all time. The discovery of high-temper ...

  2. 【bioinfo】生物信息学——代码遇见生物学的地方

    注:从进入生信领域到现在,已经过去快8年了.生物信息学包含了我最喜欢的三门学科:生物学.计算机科学和数学.但是如果突然问起,什么是生物信息学,我还是无法给出一个让自己满意的答案.于是便有了这篇博客. ...

  3. Robustness|Variability|Diversification|Complexity|自组装|

    生命组学 进化方向有以下四个特性:Robustness:变稳定,比如杀虫剂最大浓度也有杀不死的虫子.Variability易变性与Diversification多样性,容易变多和变多.Complexi ...

  4. SAGE|DNA微阵列|RNA-seq|lncRNA|scripture|tophat|cufflinks|NONCODE|MA|LOWESS|qualitile归一化|permutation test|SAM|FDR|The Bonferroni|Tukey's|BH|FWER|Holm's step-down|q-value|

    生物信息学-基因表达分析 为了丰富中心法则,研究人员使用不断更新的技术研究lncRNA的方方面面,其中技术主要是生物学上的微阵列芯片技术和表达数据分析方法,方方面面是指lncRNA的位置特征. Bac ...

  5. 2. Transcribing DNA into RNA

    Problem An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'. Given ...

  6. (转)protein 数据库

    最早关注蛋白质互作网络,是在来GDMC第一年的时候,中间停了半年看互作-各种算法,网络分析停滞不前,没想到搞到最后,还是和网络碰到了一起,我总是会潜意识走近给自己第一印象不错的object,包括人.用 ...

  7. RNA velocity | RNA速率

    单细胞转录组确实是利器,但我们大多只利用了表达的信息,而从reads到表达之间的信息完全被我们忽略了. 最近nature发了一篇单细胞方法类文章,讲得就是如何利用RNA velocity来做细胞发育路 ...

  8. RNA剪接体 Spliceosome | 冷冻电镜 | 结构生物学

    冷冻电镜 为什么冷冻电镜 (Cryo-EM) 技术的发明可以获得2017诺贝尔化学奖?知乎看法 Press release: The Nobel Prize in Chemistry 2017 We ...

  9. Deep Protein Methylation Profiling by Combined Chemical and Immunoaffinity Approaches Reveals Novel PRMT1 Targets (结合层析法和免疫沉淀法的蛋白甲基化的深度检测技术发现了PRMT1新的靶标蛋白)

    题目:Deep Protein Methylation Profiling by Combined Chemical and Immunoaffinity Approaches Reveals Nov ...

随机推荐

  1. Python 缓存机制与 functools.lru_cache(zz)

    refer to: http://kuanghy.github.io/2016/04/20/python-cache

  2. 定时器Timer&ScheduledThreadPoolExecutor

    定时器Timer&ScheduledThreadPoolExecutor /** * @ClassName: TimerTest * @author: daniel.zhao * @date: ...

  3. QT:QByteArray和QByteArray、char *(转)

    //常用参数类型:char *字符串, QByteArray字符数组, QString字符串//需要转换:char * ---转--- QByteArray ---需要调用QByteArray类的构造 ...

  4. MySQL This function has none of DETERMINISTIC, NO SQL...错误1418 的原因分析及解决方法

    MySQL开启bin-log后,调用存储过程或者函数以及触发器时,会出现错误号为1418的错误: ERROR 1418 (HY000): This function has none of DETER ...

  5. 2.运行成功的Demo(Python+Appium)

    1.打开Appium运行 2.在Pycharm输入代码如下所示: from appium import webdriver desired_caps = {} #初始化 desired_caps['p ...

  6. spring boot打包部署到Linux环境

    打包部署说白了就两步:打包.部署.废话不多说,直接拿spring boot自动生成的项目骨架,再添加一个文件用来演示: package com.crocodile.springboot; import ...

  7. Python笔试题&面试题总结

    黑色加粗的是笔试题,蓝色是面试题 1.什么是GIL 2.Python中的@staticmethod和@classmethod的区别 (**) 3.Python里面如何拷贝一个对象,并解析深浅拷贝 4. ...

  8. 智能家居入门DIY——【二、LD3320之语音识别】

    前一篇说了一下只有RX,TX,VCC,GND的WIFI模块软串口通讯:在实现了远程观察数据,类似的就可以实现远程控制.接下来说一下近距离控制,很多情况下应用语音识别技术无疑比掏出手机操作要更人性化一些 ...

  9. 转帖:关于MongoDB你需要知道的几件事

    Henrique Lobo Weissmann 是一位来自于巴西的软件开发者,他是 itexto 公司的联合创始人,这是一家咨询公司.近日,Henrique 在博客上撰文谈到了关于 MongoDB 的 ...

  10. django-中间件,流量统计实例

    Django中间件(Middleware) 中间件,顾名思义,就是处在中间的一些软件.比如匹配到了URL,但是还没有执行view函数的时候,这个时候可以执行一些代码,这个代码就是中间件. HttpRe ...