skbio.sequence.transition.k2p#

skbio.sequence.transition.k2p(d, kappa, seqtype='DNA', dtype='float32')[source]#

Calculate the K2P transition probability matrix for a given distance.

Added in version 0.7.4.

The Kimura 2-parameter (K2P, a.k.a. K80) model assumes separate rates for transitions \((A \leftrightarrow G, C \leftrightarrow T/U)\) and transversions (all other changes of substitutions), with a fixed transition/transversion rate ratio \(\kappa\).

The transition probabilities between nucleotide states for sequences separated by evolutionary distance \(d\) are given by:

\[\begin{split}\begin{aligned} &P_{no\, change} = \frac{1}{4} + \frac{1}{4} e^{\frac{-4d}{3}} + \frac{1}{2} e^{\frac{-2(\kappa + 1)d}{3}} \\ &P_{transition} = \frac{1}{4} + \frac{1}{4} e^{\frac{-4d}{3}} - \frac{1}{2} e^{\frac{-2(\kappa + 1)d}{3}} \\ &P_{transversion} = \frac{1}{4} - \frac{1}{4} e^{\frac{-4d}{3}} \end{aligned}\end{split}\]

Where \(\kappa\) is ratio between transition and transversion rates.

Parameters:
dfloat

Evolutionary distance between sequences.

kappafloat

Ratio between transition and transversion rates. Should be between 0 and 1.

seqtype{‘DNA’, ‘RNA’}, optional

Sequence type. Used to label matrix states as nucleotides (A, C, G, T/U). Default is “DNA”.

dtypestr or dtype, optional

Floating-point data type of the transition probability matrix. Options are “float32” (default) and “float64”.

Returns:
SubstitutionMatrix

Transition probability matrix. Rows are ancestral nucleotides, columns are descendant nucleotides.

Notes

The Kimura 2-parameter model (K2P or K80) was originally described in [1].

K2P is an extension of the JC69 model by modeling differential transition and transversion rates. Meanwhile, K2P can be considered as a special case of the F84 model by assuming equal base frequencies.

References

[1]

Kimura, M. (1980). A simple method for estimating evolutionary rates of base substitutions through comparative studies of nucleotide sequences. Journal of Molecular Evolution, 16(2), 111-120.