skbio.sequence.RNA.translate#

RNA.translate(genetic_code=1, *args, **kwargs)[source]#

Translate RNA sequence into protein sequence.

Parameters:
genetic_codeint, GeneticCode, optional

Genetic code to use in translation. If int, used as a table ID to look up the corresponding NCBI genetic code.

argstuple

Positional arguments accepted by GeneticCode.translate.

kwargsdict

Keyword arguments accepted by GeneticCode.translate.

Returns:
Protein

Translated sequence.

Notes

RNA sequence’s metadata are included in the translated protein sequence. Positional metadata are not included.

Examples

Translate RNA into protein using NCBI’s standard genetic code (table ID 1, the default genetic code in scikit-bio):

>>> from skbio import RNA
>>> rna = RNA('AUGCCACUUUAA')
>>> rna.translate()
Protein
--------------------------
Stats:
    length: 4
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: True
--------------------------
0 MPL*

Translate the same RNA sequence using a different NCBI genetic code (table ID 3, the yeast mitochondrial code) and specify that translation must terminate at the first stop codon:

>>> rna.translate(3, stop='require')
Protein
--------------------------
Stats:
    length: 3
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: False
--------------------------
0 MPT