當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。