skbio.sequence.DNA.translate_six_frames

DNA.translate_six_frames(*args, **kwargs)[source]

Translate DNA into protein using six possible reading frames.

State: Stable as of 0.4.0.

DNA sequence is assumed to be the coding strand. DNA sequence is first transcribed into RNA and then translated into protein. 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:

args : tuple

Positional arguments accepted by RNA.translate_six_frames.

kwargs : dict

Keyword arguments accepted by RNA.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)

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

Examples

Translate DNA 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 DNA
>>> dna = DNA('ATGCCACTTTAA')
>>> for protein in dna.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