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()));
}
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()));
}
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);
}
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);
}
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);
}
Aggregations