phydmslib.constants moduleΒΆ

Defines constants and nucleotide / amino acid / codon indices.

Constants defined:
ALMOST_ZERO (float)

a small number used to check for quantities close to zero

N_NT (int)

number of nucleotides

N_AA (int)

number of amino acids

N_CODON (int)

number of codons

N_STOP (int)

number of stop codons

NT_TO_INDEX (dict)

mapping of one-letter nucleotides to integer indices

INDEX_TO_NT (dict)

inverse of NT_TO_INDEX

AA_TO_INDEX (dict)

mapping of one-letter amino acids to integer indices

INDEX_TO_AA (dict)

inverse of AA_TO_INDEX

CODON_TO_INDEX (dict):

mapping of non-stop codons to integer indices

INDEX_TO_CODON (dict)

inverse of CODON_TO_INDEX

CODON_TO_AA (numpy.ndarray of int, length N_CODON)

Element x gives index for amino acid encoded by x.

PURINES (frozenset)

Set of one-letter nucleotides for purines

PYRIMIDINES (frozenset)

Set of one-letter nucleotides for pyrimidines

CODON_TRANSITION (numpy.ndarray of bools, shape (N_CODON, NCODON))

Element [x][y] is True iff x and y differ by 1 transition.

CODON_SINGLEMUT (numpy.ndarray of bools, shape (N_CODON, N_CODON))

Element [x][y] is True iff x and y differ by 1 nt mutation.

CODON_NT_MUT (numpy.ndarray of bools, shape (N_NT, N_CODON, N_CODON))

Element [w][x][y] is True iff x converts to y by single nucleotide mutation w.

CODON_NT (numpy.ndarray of bools, shape (3, N_NT, N_CODON))

Element [j][w][x] is True iff nt j of codon x is w.

CODON_NT_INDEX (numpy.ndarray of int, shape (3, N_CODON))

Element [j][x] gives index of nt at position j of codon x.

CODON_NONSYN (numpy.ndarray of bools, shape (N_CODON, N_CODON))

Element [x][y] is True iff mutating x to y is nonsynonymous

CODON_NT_COUNT (numpy.ndarray of int, shape (N_NT, N_CODON))

Element [w][x] gives the number of occurrences of nucleotide w in codon x.

STOP_CODON_TO_NT_INDICES

(numpy.ndarray of float, shape (N_STOP, 3, N_NT)) Element [x][p][w] is 1.0 if codon position p is nucleotide w in stop codon x and 0.0 otherwise.

STOP_POSITIONS (numpy.ndarray of float, shape (3, N_NT))

Element [p][w] is -1.0 if any stop codon has nucleotide w in codon position p and 1.0 otherwise