Search in sources :

Example 11 with JukesCantor

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;
}
Also used : BeagleTreeLikelihood(beast.evolution.likelihood.BeagleTreeLikelihood) TreeLikelihood(beast.evolution.likelihood.TreeLikelihood) SiteModel(beast.evolution.sitemodel.SiteModel) JukesCantor(beast.evolution.substitutionmodel.JukesCantor)

Aggregations

SiteModel (beast.evolution.sitemodel.SiteModel)11 JukesCantor (beast.evolution.substitutionmodel.JukesCantor)11 Test (org.junit.Test)8 ConversionGraph (bacter.ConversionGraph)5 Locus (bacter.Locus)5 Alignment (beast.evolution.alignment.Alignment)5 ClusterTree (beast.util.ClusterTree)5 Conversion (bacter.Conversion)4 BeagleTreeLikelihood (beast.evolution.likelihood.BeagleTreeLikelihood)4 Node (beast.evolution.tree.Node)4 RealParameter (beast.core.parameter.RealParameter)3 Sequence (beast.evolution.alignment.Sequence)3 TaxonSet (beast.evolution.alignment.TaxonSet)3 TreeLikelihood (beast.evolution.likelihood.TreeLikelihood)3 ConstantPopulation (beast.evolution.tree.coalescent.ConstantPopulation)3 Tree (beast.evolution.tree.Tree)2 UncertainAlignmentTest (test.beast.evolution.alignment.UncertainAlignmentTest)2 State (beast.core.State)1 TreeParser (beast.util.TreeParser)1 IOException (java.io.IOException)1