ORF Operations

ORF operations target open reading frames within sequences, enabling codon-level manipulations and translations while respecting reading frame boundaries. These operations require that the target region be annotated with annotate_orf or insert_tags so that the reading frame is known.

mutagenize_orf

Introduce codon-level missense mutations within a coding sequence.

translate

Translate a DNA pool to a protein pool.

annotate_orf

Tag an ORF region within a longer sequence.

stylize_orf

Apply alternating codon colours to visualize reading frames.

reverse_translate

Back-translate a protein pool to DNA using a codon table.

Genetic code

PoolParty uses the standard genetic code by default, with codons in each amino-acid group sorted by human codon usage frequency (source: Kazusa). The first codon in each list is the most frequent. This ordering matters: mutation_type="missense_only_first" in mutagenize_orf and codon_selection="first" in reverse_translate both select the first codon per amino acid.

The built-in table is a dict mapping single-letter amino acids to lists of codons:

{
    "M": ["ATG"],
    "F": ["TTC", "TTT"],
    "L": ["CTG", "CTC", "CTT", "TTG", "TTA", "CTA"],
    "S": ["AGC", "TCC", "TCT", "TCA", "AGT", "TCG"],
    ...
    "*": ["TGA", "TAA", "TAG"],
}

To supply a custom genetic code (e.g. for a non-standard organism or a host-optimized codon table), pass a dict in the same format:

my_table = {
    "M": ["ATG"],
    "F": ["TTT", "TTC"],   # TTT listed first
    ...
    "*": ["TAA", "TAG", "TGA"],
}
pp.init(genetic_code=my_table)

# or change after init:
pp.set_genetic_code(my_table)