skbio.sequence.RNA.translate_six_frames#

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

Translate RNA into protein using six possible reading frames.

The six possible reading frames are:

  • 1 (forward)

  • 2 (forward)

  • 3 (forward)

  • -1 (reverse)

  • -2 (reverse)

  • -3 (reverse)

Translated sequences are yielded in this order.

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_six_frames.

kwargsdict

Keyword arguments accepted by GeneticCode.translate_six_frames.

Yields:
Protein

Translated sequence in the current reading frame.

Notes

This method is faster than (and equivalent to) performing six independent translations using, for example:

(seq.translate(reading_frame=rf) for rf in GeneticCode.reading_frames)

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

Examples

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

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

Protein
--------------------------
Stats:
    length: 3
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: False
--------------------------
0 CHF

Protein
--------------------------
Stats:
    length: 3
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: False
--------------------------
0 ATL

Protein
--------------------------
Stats:
    length: 4
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: False
--------------------------
0 LKWH

Protein
--------------------------
Stats:
    length: 3
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: True
--------------------------
0 *SG

Protein
--------------------------
Stats:
    length: 3
    has gaps: False
    has degenerates: False
    has definites: True
    has stops: False
--------------------------
0 KVA