Search in sources :

Example 6 with SitePatterns

use of dr.evolution.alignment.SitePatterns in project beast-mcmc by beast-dev.

the class LikelihoodTest method testLikelihoodGTR.

public void testLikelihoodGTR() {
    System.out.println("\nTest Likelihood using GTR:");
    // Sub model
    Parameter freqs = new Parameter.Default(alignment.getStateFrequencies());
    FrequencyModel f = new FrequencyModel(Nucleotides.INSTANCE, freqs);
    Variable<Double> rateACValue = new Parameter.Default(GTRParser.A_TO_C, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    Variable<Double> rateAGValue = new Parameter.Default(GTRParser.A_TO_G, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    Variable<Double> rateATValue = new Parameter.Default(GTRParser.A_TO_T, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    Variable<Double> rateCGValue = new Parameter.Default(GTRParser.C_TO_G, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    Variable<Double> rateCTValue = new Parameter.Default(GTRParser.C_TO_T, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    Variable<Double> rateGTValue = new Parameter.Default(GTRParser.G_TO_T, 1.0, 1.0E-8, Double.POSITIVE_INFINITY);
    GTR gtr = new GTR(rateACValue, rateAGValue, rateATValue, rateCGValue, rateCTValue, rateGTValue, f);
    //siteModel
    Parameter mu = new Parameter.Default(GammaSiteModelParser.MUTATION_RATE, 1.0, 0, Double.POSITIVE_INFINITY);
    GammaSiteModel siteModel = new GammaSiteModel(gtr, mu, null, 4, null);
    //treeLikelihood
    SitePatterns patterns = new SitePatterns(alignment, null, 0, -1, 1, true);
    TreeLikelihood treeLikelihood = new TreeLikelihood(patterns, treeModel, siteModel, null, null, false, false, true, false, false);
    assertEquals("treeLikelihoodGTR", format.format(-1969.14584), format.format(treeLikelihood.getLogLikelihood()));
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) SitePatterns(dr.evolution.alignment.SitePatterns) GammaSiteModel(dr.oldevomodel.sitemodel.GammaSiteModel) GTR(dr.oldevomodel.substmodel.GTR) TreeLikelihood(dr.oldevomodel.treelikelihood.TreeLikelihood) Parameter(dr.inference.model.Parameter)

Example 7 with SitePatterns

use of dr.evolution.alignment.SitePatterns in project beast-mcmc by beast-dev.

the class LikelihoodTest method testLikelihoodHKY85I.

public void testLikelihoodHKY85I() {
    System.out.println("\nTest Likelihood using HKY85I:");
    // Sub model
    Parameter freqs = new Parameter.Default(alignment.getStateFrequencies());
    Parameter kappa = new Parameter.Default(HKYParser.KAPPA, 38.564672, 0, 100);
    FrequencyModel f = new FrequencyModel(Nucleotides.INSTANCE, freqs);
    HKY hky = new HKY(kappa, f);
    //siteModel
    Parameter mu = new Parameter.Default(GammaSiteModelParser.MUTATION_RATE, 1.0, 0, Double.POSITIVE_INFINITY);
    Parameter invar = new Parameter.Default(GammaSiteModelParser.PROPORTION_INVARIANT, 0.701211, 0, 1.0);
    GammaSiteModel siteModel = new GammaSiteModel(hky, mu, null, 4, invar);
    //treeLikelihood
    SitePatterns patterns = new SitePatterns(alignment, null, 0, -1, 1, true);
    TreeLikelihood treeLikelihood = new TreeLikelihood(patterns, treeModel, siteModel, null, null, false, false, true, false, false);
    assertEquals("treeLikelihoodHKY85I", format.format(-1789.91240), format.format(treeLikelihood.getLogLikelihood()));
}
Also used : FrequencyModel(dr.oldevomodel.substmodel.FrequencyModel) SitePatterns(dr.evolution.alignment.SitePatterns) GammaSiteModel(dr.oldevomodel.sitemodel.GammaSiteModel) HKY(dr.oldevomodel.substmodel.HKY) TreeLikelihood(dr.oldevomodel.treelikelihood.TreeLikelihood) Parameter(dr.inference.model.Parameter)

Example 8 with SitePatterns

use of dr.evolution.alignment.SitePatterns in project beast-mcmc by beast-dev.

the class NormalizedSequenceLikelihoodTest method testAllPossibleAlignments.

public void testAllPossibleAlignments() {
    SitePatterns patterns = new SitePatterns(alignment, null, 0, -1, 1, true);
    tryAllPossibleAlignments(3, patterns);
}
Also used : SitePatterns(dr.evolution.alignment.SitePatterns)

Example 9 with SitePatterns

use of dr.evolution.alignment.SitePatterns in project beast-mcmc by beast-dev.

the class AscertainmentCorrectedLikelihoodTest method testMissingPatterns.

public void testMissingPatterns() {
    SitePatterns patterns = new SitePatterns(alignment, null, 10, -1, 1, true);
    System.out.println("Using " + patterns.getPatternCount() + " patterns");
    double total = computeSumOfPatterns(patterns);
    System.out.println("Total of 10 missing (uncorrected) probabilities = " + total);
    assertEquals("uncorrected", 0.78287044, total, tolerance);
}
Also used : SitePatterns(dr.evolution.alignment.SitePatterns) AscertainedSitePatterns(dr.evolution.alignment.AscertainedSitePatterns)

Example 10 with SitePatterns

use of dr.evolution.alignment.SitePatterns in project beast-mcmc by beast-dev.

the class AscertainmentCorrectedLikelihoodTest method testAllPatterns.

public void testAllPatterns() {
    SitePatterns patterns = new SitePatterns(alignment, null, 0, -1, 1, true);
    System.out.println("Using " + patterns.getPatternCount() + " patterns");
    double total = computeSumOfPatterns(patterns);
    System.out.println("Total of all (uncorrected) probabilities = " + total);
    assertEquals("uncorrected", 1.0, total, tolerance);
}
Also used : SitePatterns(dr.evolution.alignment.SitePatterns) AscertainedSitePatterns(dr.evolution.alignment.AscertainedSitePatterns)

Aggregations

SitePatterns (dr.evolution.alignment.SitePatterns)30 Parameter (dr.inference.model.Parameter)20 FrequencyModel (dr.oldevomodel.substmodel.FrequencyModel)16 GammaSiteModel (dr.oldevomodel.sitemodel.GammaSiteModel)15 TreeLikelihood (dr.oldevomodel.treelikelihood.TreeLikelihood)15 HKY (dr.oldevomodel.substmodel.HKY)11 ArrayList (java.util.ArrayList)7 BranchRateModel (dr.evomodel.branchratemodel.BranchRateModel)6 GammaSiteRateModel (dr.evomodel.siteratemodel.GammaSiteRateModel)6 TaxonList (dr.evolution.util.TaxonList)5 BranchModel (dr.evomodel.branchmodel.BranchModel)5 ExchangeOperator (dr.evomodel.operators.ExchangeOperator)5 SubtreeSlideOperator (dr.evomodel.operators.SubtreeSlideOperator)5 WilsonBalding (dr.evomodel.operators.WilsonBalding)5 TreeModel (dr.evomodel.tree.TreeModel)5 ArrayLogFormatter (dr.inference.loggers.ArrayLogFormatter)5 MCLogger (dr.inference.loggers.MCLogger)5 TabDelimitedFormatter (dr.inference.loggers.TabDelimitedFormatter)5 MCMC (dr.inference.mcmc.MCMC)5 MCMCOptions (dr.inference.mcmc.MCMCOptions)5