cogent3.core.alphabet.SenseCodonAlphabet#

class SenseCodonAlphabet(words: tuple[str, ...], monomers: CharAlphabet[str], gap: str | None = None)#

represents the sense-codons of a GeneticCode

Attributes:
gap_char
gap_index
missing_char

not supported on CodonAlphabet

missing_index

not supported on CodonAlphabet

moltype
motif_len

always 3 for codon alphabets

num_canonical

returns the number of canonical states

Methods

count(value, /)

Return number of occurrences of value.

from_index(index)

returns a single codon from an index

from_indices(indices)

returns a list of codons from a numpy array of indices

from_rich_dict(data)

returns an instance from a serialised dictionary

index(value[, start, stop])

Return first index of value.

is_valid(seq)

seq is valid for alphabet

to_index(codon[, validate])

encodes a codon as a single integer

to_indices(seq[, validate])

returns a sequence of codon indices

to_json()

returns a serialisable string

to_rich_dict([for_pickle])

returns a serialisable dictionary

with_gap_motif(**kwargs)

returns a new SenseCodonAlphabet with the gap motif '---' added