GeneticCode.
translate_six_frames
(sequence, start='ignore', stop='ignore')[source]¶Translate RNA into protein using six possible reading frames.
State: Stable as of 0.4.0.
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.
sequence (RNA) – RNA sequence to translate.
start ({'ignore', 'require', 'optional'}) – How to handle start codons. See GeneticCode.translate
for
details.
stop ({'ignore', 'require', 'optional'}) – How to handle stop codons. See GeneticCode.translate
for
details.
Protein – Translated sequence in the current reading frame.
See also
Notes
This method is faster than (and equivalent to) performing six independent translations using, for example:
(gc.translate(seq, reading_frame=rf)
for rf in GeneticCode.reading_frames)
Input RNA sequence 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, GeneticCode
>>> rna = RNA('AUGCCACUUUAA')
>>> sgc = GeneticCode.from_ncbi()
>>> for protein in sgc.translate_six_frames(rna):
... 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