skbio.sequence.DNA.translate#

DNA.translate(*args, **kwargs)[source]#

Translate DNA sequence into protein sequence.

DNA sequence is assumed to be the coding strand. DNA sequence is first transcribed into RNA and then translated into protein.

Parameters:
argstuple

Positional arguments accepted by RNA.translate.

kwargsdict

Keyword arguments accepted by RNA.translate.

Returns:
Protein

Translated sequence.

Notes

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

Examples

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

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

Translate the same DNA 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:

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