Using genetic codes#
Selecting codes in methods that support them#
In cases where a cogent3 object method has a gc argument, you can just use the number under “Code ID” column.
For example, I’ve created a partial codon in "s1"
We specify the genetic code, and we allow incomplete codons. In this case, if a codon contains a gap, they are converted to ? in the translation.
Translate DNA sequences#
From a string
This can also be applied to a numpy array.
Conversion to a ProteinSequence from a DnaSequence is shown in Translate a sequence to protein.
Translate all six frames#
Translate a codon#
or get the codons for a single amino acid
Look up the amino acid corresponding to a single codon#
Get all the codons for one amino acid#
Get all the codons for a group of amino acids#
Getting the alphabet for the genetic code#
The default for the get_alphabet() method is to return an alphabet representing just the sense codons (a SenseCodonAlphabet instance).
Setting include_stop=True returns all codons.
You can also include “gap state” (i.e. "---") or “missing state” ("???") codons with the arguments include_gap and include_missing respectively.