skbio.sequence.RNA.translate

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

Translate RNA sequence into protein sequence.

State: Stable as of 0.4.0.

Parameters
  • genetic_code (int, GeneticCode, optional) – Genetic code to use in translation. If int, used as a table ID to look up the corresponding NCBI genetic code.

  • args (tuple) – Positional arguments accepted by GeneticCode.translate.

  • kwargs (dict) – Keyword arguments accepted by GeneticCode.translate.

Returns

Translated sequence.

Return type

Protein

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