cogent3.core.genetic_code.GeneticCode#
- class GeneticCode(code_sequence, ID=None, name=None, start_codon_sequence=None)#
Holds codon to amino acid mapping, and vice versa.
Use the get_code() function to get one of the included code instances. These are created as follows.
>>> code_sequence = 'FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG' >>> gc = GeneticCode(code_sequence) >>> sgc['UUU'] == 'F' >>> sgc['TTT'] == 'F' >>> sgc['F'] == ['TTT', 'TTC'] #in arbitrary order >>> sgc['*'] == ['TAA', 'TAG', 'TGA'] #in arbitrary order
code_sequence : 64 character string containing NCBI genetic code translation
GeneticCode is immutable once created.
- Attributes
blocks
Returns list of lists of codon blocks in the genetic code.
Methods
changes
(other)Returns dict of {codon:'XY'} for codons that differ.
get_stop_indices
(dna[, start])returns indexes for stop codons in the specified frame
is_start
(codon)Returns True if codon is a start codon, False otherwise.
is_stop
(codon)Returns True if codon is a stop codon, False otherwise.
sixframes
(dna)Returns six-frame translation as dict containing {frame:translation}
to_regex
(seq)returns a regex pattern with an amino acid expanded to its codon set
to_table
()returns aa to codon mapping as a cogent3 Table
translate
(dna[, start])Translates DNA to protein with current GeneticCode.
get_alphabet