RateEstimation.py - utilities for computing rate estimates for codon models.¶
- Tags
Python
-
RateEstimation.
evaluateCodonPair
(codon1, codon2)¶ evaluate differences between codon pair.
-
RateEstimation.
countSubstitutions
(pi, Q)¶ count substitituions given a matrix Q and frequencies pi.
-
RateEstimation.
initializeQMatrix
(codons)¶ get an initialized Q matrix.
-
RateEstimation.
getQMatrix
(pi, Rsi, Rsv, Rni, Rnv)¶ build a q matrix.
Diagonal elements are set to the negative of the row sums. The matrix is normalized such that trace of the matrix is -1.
-
RateEstimation.
getRateMatrix
(trained_model, terminals=None)¶ return a rate matrix from an xrate grammar.
- terminals: return rate matrix and frequencies for these
terminals. If none are given, a dictionaries of matrices and frequencies are returned.
-
RateEstimation.
setFrequencies
(model, mali, prefix='')¶ set frequencies in a model according to those observed in data.
prefix: prefix for rate parameters.
Frequencies are labelled: pa0, pc0, …, pa1, pc1, …, pa2, pc2, …
-
RateEstimation.
getDistanceGTR
(pi, matrix)¶ obtain distance from a GTR model. see Felsenstein 1994, pp 209