The MolType object provides services for resolving ambiguities, or providing the correct ambiguity for recoding. It also maintains the mappings between different kinds of alphabets, sequences and alignments.
If your analysis involves handling ambiguous states, or translation via a genetic code, it’s critical to specify the appropriate moltype.
Available molecular types
from cogent3 import available_moltypesavailable_moltypes()
Specify a moltype by the Abbreviation (case insensitive).
Abbreviation
Number of states
Moltype
'dna'
4
MolType(('T', 'C', 'A', 'G'))
'rna'
4
MolType(('U', 'C', 'A', 'G'))
'protein'
21
MolType(('A', 'C', 'D', 'E', 'F', 'G', ...
'protein_with_stop'
22
MolType(('A', 'C', 'D', 'E', 'F', 'G', ...
'text'
52
MolType(('a', 'b', 'c', 'd', 'e', 'f', ...
'bytes'
256
MolType((b'\x00', b'\x01', b'\x02', b'\...
6 rows x 3 columns
For statements that have a moltype argument, use the entry under the “Abbreviation” column. For example:
from cogent3 import load_aligned_seqsseqs = load_aligned_seqs("data/brca1-bats.fasta", moltype="dna")
Getting a MolType
from cogent3 import get_moltypedna = get_moltype("dna")dna