skbio.sequence.transition.tn93#
- skbio.sequence.transition.tn93(d, freqs, kappa_r, kappa_y, seqtype='DNA')[source]#
Calculate the TN93 transition probability matrix for a given distance.
Added in version 0.7.4.
The Tamura-Nei 1993 (TN93) allows differential base frequencies (\(\pi\)) and assumes different ratios \(\kappa\) between rates of transitions (substitutions between two purines or between two pyrimidines) and transversions (substitutions between a purine and a pyrimidine) for each class of nucleotides. Transition probability for a nucleotide for sequences with a distance \(d\) between them can be calculated like:
\[P_{ij} = e^{-\frac{\kappa_i d}{2b}}\delta_{ij} + e^{\frac{-d}{b}}\left (1 - e^{-\frac{(\kappa_i - 1)d}{2b}}\right ) \frac{\pi_j\epsilon_{ij}}{\sum_k \epsilon_{jk}\pi_k} + \left (1 - e^{\frac{-d}{b}}\right )\pi_j\]Where \(i,j \in \{A, C, G, T/U\}\), \(i\) is ancestral nucleotide, \(j\) is descendant nucleotide, \(\delta_{ij}\) is Kronecker delta function and is 1 if \(i=j\) and 0 otherwise, epsilon_{ij} is purine/pyrimidine indicator function which is 1 if \(i\) and \(j\) in the same nucloetide class and is 0 otherwise, \(\kappa_i\) is a transition/transversion rate ratio for purines or pyrimidines, depending on a substitution type. The normalization constant \(b\) is defined as:
\[b = 1 - \pi_A^2 - \pi_C^2 - \pi_G^2 - \pi_T^2\]- Parameters:
- dfloat
distance or distances between sequences.
- freqsarray_like of float of shape (4,)
Relative frequencies of nucleobases A, C, G, and T/U, respectively. Should sum to 1.
- kappa_r
Transition/transversion rate ratio of purines. Should be \(0 < \kappa \leq 1\).
- kappa_y
Transition/transversion rate ratio of pyrimidines. Should be \(0 < \kappa \leq 1\).
- seqtypestr
String that holds type of the sequence. “DNA” (default) and “RNA” are valid options. Needed to assign proper nucleotide letters to SubstitutionMatrix dimensions.
- Returns:
- SubstitutionMatrix
Transition probability matrix. Rows are ancestral nucleotides, columns are descendant nucleotides.
See also
Notes
The Tamura-Nei 1993 (TN93) model was described in [1]. The transition probability formulas were taken from [2].
It generalizes HKY85 by allowing different transition rates for purine and pyrimidine substitutions while maintaining a single transversion rate class. HKY85 is recovered when \(\kappa_R = \kappa_Y\).
References
[1]Tamura, K., & Nei, M. (1993). Estimation of the number of nucleotide substitutions in the control region of mitochondrial DNA in humans and chimpanzees. Molecular Biology and Evolution, 10(3), 512-526.
[2]Felsenstein, J. (2004). Inferring Phylogenies. 2003. Sinauer Associates, Sunderland, Massachusetts.