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


Java TreeParser.initByName方法代码示例

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


在下文中一共展示了TreeParser.initByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import beast.util.TreeParser; //导入方法依赖的package包/类
private void initialize(TaxonSet speciesSuperset) throws Exception {
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);

    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
        geneTrees.add(geneTree);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
        geneTreeWrappers.add(geneTreeWrapper);
    }

    state.initByName("stateNode", alphaParameter);
    state.initByName("stateNode", meanParameter);

    msc = new MultispeciesCoalescent();
    msc.initByName("populationShape", alphaParameter, "populationMean", meanParameter, "distribution", geneTreeWrappers);

    for (GeneTree gt: geneTreeWrappers) gt.calculateLogP();
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:23,代码来源:MissingDataConstantIO.java

示例2: testLogP

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testLogP() throws Exception {
    TaxonSet speciesSuperset = generateSuperset();
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);

    final int nBranches = nSpecies * 2 - 1;
    popsizeParameter.initByName("value", String.valueOf(popSize), "dimension", String.valueOf(nBranches));
    state.initByName("stateNode", popsizeParameter);

    popModel = new ConstantPopulations();
    popModel.initByName("populationSizes", popsizeParameter, "speciesTree", speciesTree);

    double calculatedLogP = 0.0;
    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree, "populationModel", popModel);
        calculatedLogP += geneTreeWrapper.calculateLogP();
    }

    // System.out.println(String.format("expected %f, calculated %f", expectedLogP, calculatedLogP));
    assertEquals(expectedLogP, calculatedLogP, allowedError);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:27,代码来源:IncompatibleTreeTest.java

示例3: initialize

import beast.util.TreeParser; //导入方法依赖的package包/类
private void initialize(TaxonSet speciesSuperset) throws Exception {
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);

    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
        geneTrees.add(geneTree);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
        geneTreeWrappers.add(geneTreeWrapper);
    }

    state.initByName("stateNode", alphaParameter);
    state.initByName("stateNode", meanParameter);

    msc = new MultispeciesCoalescent();
    msc.initByName("populationShape", alphaParameter, "populationMean", meanParameter, "distribution", geneTreeWrappers);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:21,代码来源:ConstantIOTest.java

示例4: testNonBinarySortedNewickTest

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testNonBinarySortedNewickTest() {

    String newick = "((A:1.0,B:1.0,C:1.0):1.0,(D:1.0,E:1.0,F:1.0,G:1.0):1.0):0.0;";

    TreeParser treeParser = new TreeParser();
    treeParser.initByName("IsLabelledNewick", true,
    		"newick", newick,
    		"adjustTipHeights", false,
            "binarizeMultifurcations", false);

    String sortedNewick = treeParser.getRoot().toSortedNewick(new int[1], false);
    String goal = "((1:1.0,2:1.0,3:1.0):1.0,(4:1.0,5:1.0,6:1.0,7:1.0):1.0):0.0";

    assertEquals(goal.split(";")[0], sortedNewick);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:17,代码来源:NodeTest.java

示例5: testClusterTree

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testClusterTree() throws Exception {
    Alignment data = BEASTTestCase.getAlignment();
    Tree tree = new Tree();
    tree.initAndValidate();
    assertEquals(true, tree.getNodeCount() == 1);

    TreeParser tree2 = new TreeParser();
    tree2.initByName(
            "initial", tree,
            "taxa", data,
            "newick", "((((human:0.024003,(chimp:0.010772,bonobo:0.010772):0.013231):0.012035,gorilla:0.036038):0.033087000000000005,orangutan:0.069125):0.030456999999999998,siamang:0.099582);",
            "IsLabelledNewick", true);

    assertEquals(true, tree.getNodeCount() > 1);
    assertEquals(11, tree.getNodeCount());
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:18,代码来源:StateNodeInitialiserTest.java

示例6: initializeGeneTrees

import beast.util.TreeParser; //导入方法依赖的package包/类
public void initializeGeneTrees() throws Exception {
    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);
        geneTrees.add(geneTree);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTreeWrapper);
        geneTreeWrappers.add(geneTreeWrapper);
    }
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:12,代码来源:ExchangeTestHelper.java

示例7: testRates

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testRates() throws Exception {
    testTree = new TreeParser();
    testTree.initByName("newick", newickTree, "IsLabelledNewick", true);

    // Create dummy state to allow statenode editing
    State state = new State();
    state.initialise();

    treeLengthLogger = new TreeLengthLogger();
    treeLengthLogger.initByName("tree", testTree);
    final double computedLength = treeLengthLogger.getArrayValue();

    assertEquals(expectedLength, computedLength, allowedError);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:16,代码来源:TreeLengthLoggerTest.java

示例8: initializeTrees

import beast.util.TreeParser; //导入方法依赖的package包/类
public void initializeTrees(TaxonSet speciesSuperSet) throws Exception {
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperSet);

    geneTree = new TreeParser();
    geneTree.initByName("newick", newickGeneTree, "IsLabelledNewick", true);

    geneTreeWrapper = new GeneTree();
    geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:11,代码来源:StarbeastClockTest.java

示例9: testLogP

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testLogP() throws Exception {
    TaxonSet speciesSuperset = generateSuperset();
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);
    state.initByName("stateNode", speciesTree);

    tipPopSizesParameter.initByName("dimension", String.valueOf(nSpecies), "value", 1.0);
    topPopSizesParameter.initByName("dimension", String.valueOf(nSpecies * 2 - 2), "value", 1.0);
    state.initByName("stateNode", tipPopSizesParameter);
    state.initByName("stateNode", topPopSizesParameter);
    state.initialise();

    popModel = new LinearWithConstantRoot();
    popModel.initByName("tipPopulationSizes", tipPopSizesParameter, "topPopulationSizes", topPopSizesParameter, "speciesTree", speciesTree);
    popModel.initPopSizes(popSize);

    double calculatedLogP = 0.0;
    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree, "populationModel", popModel);
        calculatedLogP += geneTreeWrapper.calculateLogP();
    }

    // System.out.println(String.format("expected %f, calculated %f", expectedLogP, calculatedLogP));
    assertEquals(expectedLogP, calculatedLogP, allowedError);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:31,代码来源:LinearWithConstantRootTest.java

示例10: testLogP

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testLogP() throws Exception {
    TaxonSet speciesSuperset = generateSuperset();
    speciesTree = new SpeciesTreeParser();
    speciesTree.initByName("newick", newickSpeciesTree, "IsLabelledNewick", true, "taxonset", speciesSuperset);
    state.initByName("stateNode", speciesTree);

    final int nBranches = nSpecies * 2 - 1;
    popsizeParameter.initByName("value", String.valueOf(popSize), "dimension", String.valueOf(nBranches));
    state.initByName("stateNode", popsizeParameter);
    state.initialise();

    popModel = new ConstantPopulations();
    popModel.initByName("populationSizes", popsizeParameter, "speciesTree", speciesTree);

    double calculatedLogP = 0.0;
    for (String geneTreeNewick: newickGeneTrees) {
        TreeParser geneTree = new TreeParser();
        geneTree.initByName("newick", geneTreeNewick, "IsLabelledNewick", true);

        GeneTree geneTreeWrapper = new GeneTree();
        geneTreeWrapper.initByName("tree", geneTree, "ploidy", ploidy, "speciesTree", speciesTree, "populationModel", popModel);
        calculatedLogP += geneTreeWrapper.calculateLogP();
    }

    // System.out.println(String.format("expected %f, calculated %f", expectedLogP, calculatedLogP));
    assertEquals(expectedLogP, calculatedLogP, allowedError);
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:29,代码来源:ConstantPopulationTest.java

示例11: main

import beast.util.TreeParser; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		Sequence a = new Sequence("A", "A");
        Sequence b = new Sequence("B", "A");
        Sequence c = new Sequence("C", "A");
        Sequence d = new Sequence("D", "A");

        Alignment data = new Alignment();
        data.initByName("sequence", a, "sequence", b, "sequence", c, "sequence", d, "dataType", "nucleotide");

        TreeParser tree = new TreeParser();
        tree.initByName("taxa", data,
                "newick", "(((A:1,B:1):1,C:2):1,D:3)",
                "IsLabelledNewick", true);

        JukesCantor JC = new JukesCantor();
        JC.initAndValidate();

        SiteModel siteModel = new SiteModel();
        siteModel.initByName("mutationRate", "1.0", "gammaCategoryCount", 1, "substModel", JC);

    	BeagleTreeLikelihood likelihood = new BeagleTreeLikelihood();
        likelihood.initByName("data", data, "tree", tree, "siteModel", siteModel);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

   	
   	System.out.println("Success");
   	// if we got this far, exit with status 0
	System.exit(0);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:34,代码来源:Utils.java

示例12: testBinarySortedNewickTest

import beast.util.TreeParser; //导入方法依赖的package包/类
@Test
public void testBinarySortedNewickTest() {

    String newick = "((D:5.0,C:4.0):6.0,(A:1.0,B:2.0):3.0):0.0;";

    TreeParser treeParser = new TreeParser();
    treeParser.initByName("IsLabelledNewick", true,
    		"newick", newick,
    		"adjustTipHeights", false);

    String sortedNewick = treeParser.getRoot().toSortedNewick(new int[1], false);
    String goal = "((1:1.0,2:2.0):3.0,(3:4.0,4:5.0):6.0):0.0";

    assertEquals(goal.split(";")[0], sortedNewick);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:16,代码来源:NodeTest.java

示例13: getTreeB

import beast.util.TreeParser; //导入方法依赖的package包/类
static public Tree getTreeB(Alignment data) throws Exception {
    TreeParser tree = new TreeParser();
    tree.initByName("taxa", data,
            "newick", "(seq1:2,(seq2:1,seq3:1):1);",
            "IsLabelledNewick", true);
    return tree;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:8,代码来源:UncertainAlignmentTest.java

示例14: getTreeA

import beast.util.TreeParser; //导入方法依赖的package包/类
static public Tree getTreeA(Alignment data) throws Exception {
    TreeParser tree = new TreeParser();
    tree.initByName("taxa", data,
            "newick", "((seq1:1,seq2:1):1,seq3:2);",
            "IsLabelledNewick", true);
    return tree;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:8,代码来源:UncertainAlignmentTest.java

示例15: getTree

import beast.util.TreeParser; //导入方法依赖的package包/类
static public Tree getTree(Alignment data, String tree) throws Exception {
    TreeParser t = new TreeParser();
    t.initByName("taxa", data,
            "newick", tree,
            "IsLabelledNewick", true);
    return t;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:8,代码来源:BEASTTestCase.java


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