translate
Translate a DNA pool into a protein pool using the standard genetic code.
Pass region= to translate only a named ORF segment; include_stop=False
omits the trailing stop codon from the output.
import poolparty as pp
pp.init()
Parameters
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
(required) |
DNA pool or plain sequence string to translate. |
|
|
|
Region name (from |
|
|
|
Reading frame ( |
|
|
|
When |
|
|
|
If |
|
|
|
Built-in code name or a custom codon table mapping. |
|
|
|
Enumeration order when combined with other pools. |
|
|
|
Prefix for sequence names in the resulting pool. |
Note
Only the most commonly used parameters are shown above. For the full
parameter list, see translate() in the
API Reference.
Examples
Translate a 5-codon CDS
Translate the 15-nucleotide sequence ATGAAATTTGGGCCC to the 5-residue
peptide M-K-F-G-P.
cds = pp.from_seq("ATGAAATTTGGGCCC")
protein = pp.translate(cds)
protein.print_library()
Translate a mutagenized CDS pool
Chain mutagenize_orf with translate. When mutagenize_orf applies
style="red", translate preserves that style on the resulting amino
acid (controlled by preserve_codon_styles, default True).
cds = pp.from_seq("ATGAAATTTGGGCCC")
mutants = pp.mutagenize_orf(cds, num_mutations=1, mode="random", style="red")
protein = pp.translate(mutants)
protein.print_library()
MTFGP
MKFGR
LKFGP ... (stochastic; mutated residue highlighted)
Translate only the ORF region within a longer sequence
When the CDS is embedded in flanking UTR context, tag it with
annotate_orf and pass the region name to translate so only the
annotated ORF is translated.
seq = pp.from_seq("TATAATGAAATTTGGGCCCTAA")
seq = pp.annotate_orf(seq, "gene", extent=(4, 19))
prot = pp.translate(seq, region="gene", include_stop=False)
prot.print_library()
See translate().