当前位置: 首页>>代码示例>>Java>>正文


Java TreeLikelihood.initByName方法代码示例

本文整理汇总了Java中beast.evolution.likelihood.TreeLikelihood.initByName方法的典型用法代码示例。如果您正苦于以下问题:Java TreeLikelihood.initByName方法的具体用法?Java TreeLikelihood.initByName怎么用?Java TreeLikelihood.initByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在beast.evolution.likelihood.TreeLikelihood的用法示例。


在下文中一共展示了TreeLikelihood.initByName方法的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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:27,代码来源:TreeLikelihoodTest.java

示例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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:23,代码来源:TreeLikelihoodTest.java

示例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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:25,代码来源:TreeLikelihoodTest.java

示例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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:26,代码来源:TreeLikelihoodTest.java

示例5: testWVLikelihoodCore0

import beast.evolution.likelihood.TreeLikelihood; //导入方法依赖的package包/类
public void testWVLikelihoodCore0(){
    try{
        Alignment data = getAlignment();
        Tree tree = getTree(data);
        SiteModel siteModel = getDefaultSiteModel();

        int[] patternWeights = data.getWeights();
        NewWVTreeLikelihood newTreeLik = new NewWVTreeLikelihood(patternWeights);
        newTreeLik.initByName(
                "data", data,
                "tree", tree,
                "siteModel", siteModel
        );

        TreeLikelihood treeLik = new TreeLikelihood();
        treeLik.initByName(
                "data", data,
                "tree", tree,
                "siteModel", siteModel
        );
    }catch(Exception e){
        throw new RuntimeException(e);
    }
}
 
开发者ID:jessiewu,项目名称:substBMA,代码行数:25,代码来源:WVLikelihoodCoreTest.java

示例6: 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;
}
 
开发者ID:tgvaughan,项目名称:bacter,代码行数:19,代码来源:ACGLikelihoodSlow.java

示例7: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:28,代码来源:TreeLikelihoodTest.java

示例8: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:31,代码来源:TreeLikelihoodTest.java

示例9: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:TreeLikelihoodTest.java

示例10: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:TreeLikelihoodTest.java

示例11: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:28,代码来源:TreeLikelihoodTest.java

示例12: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:TreeLikelihoodTest.java

示例13: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:29,代码来源:TreeLikelihoodTest.java

示例14: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:30,代码来源:TreeLikelihoodTest.java

示例15: 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);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:13,代码来源:TreeLikelihoodTest.java


注:本文中的beast.evolution.likelihood.TreeLikelihood.initByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。