本文整理汇总了Java中beast.evolution.likelihood.TreeLikelihood.calculateLogP方法的典型用法代码示例。如果您正苦于以下问题:Java TreeLikelihood.calculateLogP方法的具体用法?Java TreeLikelihood.calculateLogP怎么用?Java TreeLikelihood.calculateLogP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beast.evolution.likelihood.TreeLikelihood
的用法示例。
在下文中一共展示了TreeLikelihood.calculateLogP方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testHKY85Likelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testHKY85Likelihood() throws Exception {
// Set up HKY85 model: estimated freqs, kappa = 29.739445, 0 gamma categories
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
HKY hky = new HKY();
hky.initByName("kappa", "29.739445", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1825.2131708068507, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1825.2131708068507, BEASTTestCase.PRECISION);
}
示例2: testJC69Likelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testJC69Likelihood() throws Exception {
// Set up JC69 model: uniform freqs, kappa = 1, 0 gamma categories
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
JukesCantor JC = new JukesCantor();
JC.initAndValidate();
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", JC);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1992.2056440317247, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1992.2056440317247, BEASTTestCase.PRECISION);
}
示例3: testAscertainedJC69Likelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testAscertainedJC69Likelihood() throws Exception {
// as testJC69Likelihood but with ascertained alignment
Alignment data = BEASTTestCase.getAscertainedAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data,
"estimate", false);
HKY hky = new HKY();
hky.initByName("kappa", "1.0", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
// the following number comes from Beast 1.6
assertEquals(logP, -737.7140695360017, BEASTTestCase.PRECISION);
}
示例4: testBinaryCovarionLikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testBinaryCovarionLikelihood() throws Exception {
Alignment data = BEASTTestCase.getCovarionAlignment();
Tree tree = BEASTTestCase.getTree(data, "((English_ST:0.22743347188019544,(German_ST:0.10557648379843088,Dutch_List:0.10557648379843088):0.12185698808176457):1.5793160946109988,(Spanish:0.11078392189606047,(Italian:0.10119772534558173,French:0.10119772534558173):0.009586196550478737):1.6959656445951337)");
RealParameter alpha = new RealParameter("0.284");
RealParameter switchRate = new RealParameter("0.829");
RealParameter frequencies = new RealParameter("0.683 0.317");
RealParameter hfrequencies = new RealParameter("0.5 0.5");
BinaryCovarion covarion = new BinaryCovarion();
covarion.initByName("alpha", alpha, "switchRate", switchRate, "vfrequencies", frequencies, "hfrequencies", hfrequencies);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", covarion);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
// beast1 xml gives -1730.5363
assertEquals(logP, -1730.53631739, BEASTTestCase.PRECISION);
}
示例5: calculateLogP
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Override
public double calculateLogP() {
logP = 0.0;
for (Region region : acg.getRegions(locus)) {
Alignment margAlign = createMarginalAlignment(alignment, acg, region);
Tree margTree = new Tree(new MarginalTree(acg, region).getRoot());
TreeLikelihood treeLikelihood = new TreeLikelihood();
treeLikelihood.initByName(
"data", margAlign,
"tree", margTree,
"siteModel", siteModel,
"useAmbiguities", useAmbiguitiesInput.get());
logP += treeLikelihood.calculateLogP();
}
return logP;
}
示例6: testK80Likelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testK80Likelihood() throws Exception {
// Set up K80 model: uniform freqs, kappa = 27.402591, 0 gamma categories
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data,
"estimate", false);
HKY hky = new HKY();
hky.initByName("kappa", "27.40259", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1856.303048876734, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1856.303048876734, BEASTTestCase.PRECISION);
}
示例7: testHKY85GLikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testHKY85GLikelihood() throws Exception {
// Set up HKY85+G model: estimated freqs, kappa = 38.82974, 4 gamma categories, shape = 0.137064
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
HKY hky = new HKY();
hky.initByName("kappa", "38.82974", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 4,
"shape", "0.137064",
"proportionInvariant", "0.0",
"substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
System.err.println(logP - -1789.7593576610134);
assertEquals(logP, -1789.7593576610134, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1789.7593576610134, BEASTTestCase.PRECISION);
}
示例8: testHKY85ILikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testHKY85ILikelihood() throws Exception {
// Set up HKY85+I model: estimated freqs, kappa = 38.564672, 0 gamma categories, prop invariant = 0.701211
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
HKY hky = new HKY();
hky.initByName("kappa", "38.564672", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1,
"shape", "0.137064",
"proportionInvariant", "0.701211",
"substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1789.912401996943, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1789.912401996943, BEASTTestCase.PRECISION);
}
示例9: testHKY85GILikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testHKY85GILikelihood() throws Exception {
// Set up HKY85+G+I model: estimated freqs, kappa = 39.464538, 4 gamma categories, shape = 0.587649, prop invariant = 0.486548
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
HKY hky = new HKY();
hky.initByName("kappa", "39.464538", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 4,
"shape", "0.587649",
"proportionInvariant", "0.486548",
"substModel", hky);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1789.639227747059, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", true, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1789.639227747059, BEASTTestCase.PRECISION);
}
示例10: testGTRLikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testGTRLikelihood() throws Exception {
// Set up GTR model: no gamma categories, no proportion invariant
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
GTR gsm = new GTR();
gsm.initByName("frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1,
"substModel", gsm);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1969.145839307625, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", false, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1969.145839307625, BEASTTestCase.PRECISION);
}
示例11: testGTRILikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testGTRILikelihood() throws Exception {
// Set up GTR model: prop invariant = 0.5
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
GeneralSubstitutionModel gsm = new GeneralSubstitutionModel();
gsm.initByName("rates", "1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1,
"proportionInvariant", "0.5",
"substModel", gsm);
//siteModel.init("1.0", 1, null, "0.5", gsm);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1948.8417455357564, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", false, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1948.8417455357564, BEASTTestCase.PRECISION);
}
示例12: testGTRGLikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testGTRGLikelihood() throws Exception {
// Set up GTR model: 4 gamma categories, gamma shape = 0.5
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
GeneralSubstitutionModel gsm = new GeneralSubstitutionModel();
gsm.initByName("rates", "1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 4,
"shape", "0.5",
"substModel", gsm);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1949.0360143622, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", false, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1949.0360143622, BEASTTestCase.PRECISION);
}
示例13: testGTRGILikelihood
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
@Test
public void testGTRGILikelihood() throws Exception {
// Set up GTR model: 4 gamma categories, gamma shape = 0.5, prop invariant = 0.5
Alignment data = BEASTTestCase.getAlignment();
Tree tree = BEASTTestCase.getTree(data);
Frequencies freqs = new Frequencies();
freqs.initByName("data", data);
GeneralSubstitutionModel gsm = new GeneralSubstitutionModel();
gsm.initByName("rates", "1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0", "frequencies", freqs);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 4,
"shape", "0.5",
"proportionInvariant", "0.5",
"substModel", gsm);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(logP, -1947.5829396144961, BEASTTestCase.PRECISION);
likelihood.initByName("useAmbiguities", false, "data", data, "tree", tree, "siteModel", siteModel);
logP = likelihood.calculateLogP();
assertEquals(logP, -1947.5829396144961, BEASTTestCase.PRECISION);
}
示例14: aminoacidModelTest
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
void aminoacidModelTest(SubstitutionModel substModel, double expectedValue) throws Exception {
Alignment data = BEASTTestCase.getAminoAcidAlignment();
Tree tree = BEASTTestCase.getAminoAcidTree(data);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", substModel);
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(expectedValue, logP, BEASTTestCase.PRECISION);
}
示例15: aminoacidModelTestI
import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
void aminoacidModelTestI(SubstitutionModel substModel, double expectedValue) throws Exception {
Alignment data = BEASTTestCase.getAminoAcidAlignment();
Tree tree = BEASTTestCase.getAminoAcidTree(data);
SiteModel siteModel = new SiteModel();
siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", substModel,
"proportionInvariant", "0.2");
TreeLikelihood likelihood = newTreeLikelihood();
likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
double logP = 0;
logP = likelihood.calculateLogP();
assertEquals(expectedValue, logP, BEASTTestCase.PRECISION);
}