skbio.sequence.transition.f81#

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

Calculate the F81 transition probability matrix for a given distance.

Added in version 0.7.4.

The Felsenstein 1981 (F81) model assumes equal substitution rates among nucleotide pairs but allows unequal equilibrium base frequencies \(\pi\).

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

\[\begin{split}P_{ij} = \begin{cases} \pi_i + (1 - \pi_i) e^{-\frac{d}{b}} & i = j \\ \pi_j (1 - e^{-\frac{d}{b}}) & i \neq j \end{cases}\end{split}\]

Where \(i,j \in \{A, C, G, T/U\}\), \(i\) is ancestral nucleotide, \(j\) is descendant nucleotide. The normalization constant \(b\) is defined as:

\[b = 1 - \pi_A^2 - \pi_C^2 - \pi_G^2 - \pi_T^2\]
Parameters:
dfloat

Evolutionary distance between sequences.

freqsarray_like of float of shape (4,)

Relative frequencies of nucleobases A, C, G, and T/U, respectively. Should sum to 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 Felsenstein 1981 (F81) model was originally introduced in [1].

It extends JC69 by allowing unequal equilibrium base frequencies while retaining equal substitution rates between all nucleotide pairs.

F81 reduces to JC69 when all base frequencies are equal (\(\pi_i = 0.25\)).

References

[1]

Felsenstein, J. (1981). Evolutionary trees from DNA sequences: a maximum likelihood approach. Journal of Molecular Evolution, 17(6), 368-376.