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


Java RandomTree类代码示例

本文整理汇总了Java中beast.evolution.tree.RandomTree的典型用法代码示例。如果您正苦于以下问题:Java RandomTree类的具体用法?Java RandomTree怎么用?Java RandomTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: randomTreeTest

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
private static void randomTreeTest() throws Exception {
	StringBuilder traitSB = new StringBuilder();
	List<Sequence> seqList = new ArrayList<Sequence>();

	for (int i = 0; i < 10; i++) {
		String taxonID = "t " + i;
		seqList.add(new Sequence(taxonID, "?"));

		if (i > 0)
			traitSB.append(",");
		traitSB.append(taxonID).append("=").append(i);
	}

	Alignment alignment = new Alignment(seqList, "nucleotide");
	ConstantPopulation popFunc = new ConstantPopulation();
	popFunc.initByName("popSize", new RealParameter("1.0"));
	RandomTree t = new RandomTree();
	t.initByName("taxa", alignment, "populationModel", popFunc);

	Sequence l = new Sequence("", "");

	System.out.println("Tree GTR Borrowing Test");
	Tree tree = randomYuleTree(2, 0.01);
	tree.getRoot().setMetaData("lang", l);
	System.out.println(TreeUtils.getTreeLength(tree, tree.getRoot()));
}
 
开发者ID:lutrasdebtra,项目名称:Beast-Borrowing-Plugin,代码行数:27,代码来源:BeastBorrowingPluginTest.java

示例2: initWithMRCACalibrations

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
private void initWithMRCACalibrations(List<MRCAPrior> calibrations) {
    final Tree spTree = speciesTreeInput.get();
    final RandomTree rnd = new RandomTree();
    rnd.setInputValue("taxonset", spTree.getTaxonset());

    for( final MRCAPrior cal : calibrations ) {
      rnd.setInputValue("constraint", cal);
    }
    ConstantPopulation pf = new ConstantPopulation();
    pf.setInputValue("popSize", new RealParameter("1.0"));

    rnd.setInputValue("populationModel", pf);
    rnd.initAndValidate();
    spTree.assignFromWithoutID((Tree)rnd);

    final double rootHeight = spTree.getRoot().getHeight();
    randomInitGeneTrees(rootHeight);
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:19,代码来源:StarBeastStartState.java

示例3: randomInit

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
private void randomInit(final SpeciesTree speciesTree, List<MRCAPrior> calibrations) {
	final RealParameter birthRateParameter = birthRate.get();
	final Double lambda = (birthRateParameter == null) ? 1.0 : birthRateParameter.getValue();
	final Double initialPopSize = 1.0 / lambda; // scales coalescent tree height inverse to birth rate
	final RealParameter popSize = new RealParameter(initialPopSize.toString());
    final ConstantPopulation pf = new ConstantPopulation();
    pf.setInputValue("popSize", popSize);

    final RandomTree rnd = new RandomTree();
    rnd.setInputValue("taxonset", speciesTree.getTaxonset());
    if (speciesTree.hasDateTrait()) rnd.setInputValue("trait", speciesTree.getDateTrait());

    for (final MRCAPrior cal: calibrations) rnd.setInputValue("constraint", cal);

    rnd.setInputValue("populationModel", pf);
    rnd.setInputValue("populationModel", pf);
    rnd.initAndValidate();

    speciesTree.assignFromWithoutID(rnd);
    // System.out.println("BEFORE = " + speciesTree.toString());

    /*final TraitSet speciesTipDates = speciesTree.getDateTrait();
    if (speciesTree.hasDateTrait()) {
    	for (Node node: speciesTree.getNodesAsArray()) {
    		if (node.isLeaf()) {
    			final String taxonName = node.getID();
    			final double taxonHeight = speciesTipDates.getValue(taxonName);
    			node.setHeight(taxonHeight);
    			
    		}
    	}
        System.out.println("AFTER = " + speciesTree.toString());
    }*/
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:35,代码来源:StarBeastInitializer.java

示例4: getTree

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
static public Tree getTree(TaxonSet taxa) throws Exception {
    Tree tree = new RandomTree();
    TraitSet dates = getDates(taxa);
    ConstantPopulation constant = new ConstantPopulation();
    constant.initByName("popSize", new RealParameter("5.0"));
    tree.initByName(
            "taxonset", taxa,
            "populationModel", constant,
            "trait", dates);
    return tree;
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:12,代码来源:UnorderedAlignmentsTest.java

示例5: getRandomTree

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
public Tree getRandomTree(double popSize, Alignment dummyAlg, String[] taxa, int[] dates) throws Exception {
        TaxonSet taxonSet = new TaxonSet(dummyAlg);
        StringBuilder traitSB = new StringBuilder();
        for (int i=0; i<taxa.length; i++) {
            if (i>0)
                traitSB.append(",");
            traitSB.append(taxa[i]).append("=").append(dates[i]);
        }
//        out.println(traitSB.toString());

        TraitSet timeTrait = new TraitSet();
        timeTrait.initByName(
                "traitname", "date-backward",
                "taxa", taxonSet,
                "value", traitSB.toString());

        ConstantPopulation popFunc = new ConstantPopulation();
        popFunc.initByName("popSize", new RealParameter(Double.toString(popSize)));

        // Create RandomTree and TreeInterval instances
        RandomTree tree = new RandomTree();
//        TreeIntervals intervals = new TreeIntervals();

        tree.initByName(
                "taxa", dummyAlg,
                "populationModel", popFunc,
                "trait", timeTrait);

//        intervals.initByName("tree", tree);

        return tree;
    }
 
开发者ID:CompEvol,项目名称:NZGOT,代码行数:33,代码来源:TreeSeqSimulatorCustomized.java

示例6: getRandomTree

import beast.evolution.tree.RandomTree; //导入依赖的package包/类
public Tree getRandomTree(double popSize, Alignment dummyAlg, String[] taxa, int[] dates) throws Exception {
        TaxonSet taxonSet = new TaxonSet(dummyAlg);
        traitSB = new StringBuilder();
        for (int i=0; i<taxa.length; i++) {
            if (i>0)
                traitSB.append(",");
            traitSB.append(taxa[i]).append("=").append(dates[i]);
        }
//        out.println(traitSB.toString());

        TraitSet timeTrait = new TraitSet();
        timeTrait.initByName(
                "traitname", traitName,
                "taxa", taxonSet,
                "value", traitSB.toString());

        ConstantPopulation popFunc = new ConstantPopulation();
        popFunc.initByName("popSize", new RealParameter(Double.toString(popSize)));

        // Create RandomTree and TreeInterval instances
        RandomTree tree = new RandomTree();
//        TreeIntervals intervals = new TreeIntervals();

        tree.initByName(
                "taxa", dummyAlg,
                "populationModel", popFunc,
                "trait", timeTrait);

//        intervals.initByName("tree", tree);

        return tree;
    }
 
开发者ID:CompEvol,项目名称:NZGOT,代码行数:33,代码来源:TreeSeqSimulator.java


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