use of beast.evolution.substitutionmodel.JukesCantor in project beast2 by CompEvol.
the class TreeLikelihoodTest method testJC69Likelihood.
public double[] testJC69Likelihood(Alignment data, Tree tree) throws Exception {
// Set up JC69 model: uniform freqs, kappa = 1, 0 gamma categories
JukesCantor JC = new JukesCantor();
JC.initAndValidate();
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "0.6", "substModel", JC);
// NB The rate in the JC model used here is actually alpha * 3 in the usual sense, because
// it's divided by 3 before multiplying in the exponent (not sure why)
System.out.println("Without tip likelihoods:");
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel, "scaling", TreeLikelihood.Scaling.none);
double[] logP = new double[2];
logP[0] = likelihood.calculateLogP();
System.out.println(logP[0]);
System.out.println("With tip likelihoods:");
likelihood.initByName("useTipLikelihoods", true, "data", data, "tree", tree, "siteModel", siteModel, "scaling", TreeLikelihood.Scaling.none);
logP[1] = likelihood.calculateLogP();
System.out.println(logP[1]);
return logP;
}
Aggregations