LinguaPhylo / linguaPhylo

LinguaPhylo: A language for describing, visualising and simulating probabilistic phylogenetic models
GNU Lesser General Public License v3.0
17 stars 7 forks source link

Add SubstitutionModel type #32

Open alexeid opened 4 years ago

alexeid commented 4 years ago

This will allow the equilibrium frequencies and the data type to be provided by the SubstitutionModel along with the instantaneous rate matrix.

walterxie commented 4 years ago

Maybe, we should have SubstitutionModel interface. In addition, I suggest to move private void getTransitionProbabilities(double branchLength, double[][] transProbs) in line 326 in PhyloCTMC to this interface. Then, you can remove numStates from PhyloCTMC, and all related code, such as:

Array2DRowRealMatrix Qmatrix = new Array2DRowRealMatrix(primitive);
decomposition = new EigenDecomposition(Qmatrix);
Eval = decomposition.getRealEigenvalues();
Ievc = new double[numStates][numStates];