Library for the Development and Use of Phylogenetic Network Methods
Character-to-state mapping for biological sequence data (DNA, RNA, Protein, Codon, SNP).
Error class for all errors relating to alphabet mappings.
Immutable mapping from character symbols to integer indices.
Class that deals with the mapping from characters to state values that have partial likelihood values associated with them. This state mapping is primarily based on Base10 -> Binary conversions such that the decimal numbers become a generalized version of the one-hot encoding scheme. DNA MAPPING INFORMATION Symbol(s) Name Partial Likelihood A Adenine [1,0,0,0] -> 1 C Cytosine [0,1,0,0] -> 2 G Guanine [0,0,1,0] -> 4 T U Thymine [0,0,0,1] -> 8 Symbol(s) Name Partial Likelihood X Any A C G T ([1,1,1,1] -> 15) V Not T A C G ([1,1,1,0] -> 7) H Not G A C T ([1,1,0,1] -> 11) D Not C A G T ([1,0,1,1] -> 13) B Not A C G T ([0,1,1,1] -> 14) M Amino A C ([1,1,0,0] -> 3) R Purine A G ([1,0,1,0] -> 5) W Weak A T ([1,0,0,1] -> 9) S Strong C G ([0,1,1,0] -> 6) Y ...
Initialize this Alphabet object with a mapping of choice. May be from any of the predefined mappings {DNA, RNA, PROTEIN, CODON}, or it can be a special user defined alphabet. For SNP alphabets, use the helper function 'snp_alphabet' with your desired ploidy upperbound and generate a custom alphabet that way.
| Parameter | Type | Description |
|---|---|---|
| mapping | AlphabetMapping | Any of the constant type alphabets (from the set {DNA, RNA, PROTEIN, CODON}), or a user defined alphabet. |
Return mapping for a character encountered in a nexus file
| Parameter | Type | Description |
|---|---|---|
| char | str | nexus file matrix data point |
AlphabetError: if the char encountered is undefined for the data mapping.Returns a string that is equal to the alphabet constant name. ie. if one is using the DNA alphabet, this function will return "DNA"
Get the character that maps to "state" in the given alphabet
| Parameter | Type | Description |
|---|---|---|
| state | int | a value in the alphabet map |
AlphabetError: if the provided state is not a valid one in the alphabetFor SNP alphabet initialization. For data sets in which the maximum ploidy is Xn, use X as @ploidy. For phased SNP data, use 1. For unphased SNP data, use 2.
| Parameter | Type | Description |
|---|---|---|
| ploidy | int | The ploidyness value of a species (ie, humans = 2, some plants > 2, etc) |