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


Java Tree.assignFromWithoutID方法代码示例

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


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

示例1: initWithMRCACalibrations

import beast.evolution.tree.Tree; //导入方法依赖的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

示例2: initFromNewick

import beast.evolution.tree.Tree; //导入方法依赖的package包/类
private void initFromNewick(final Tree speciesTree, final String newick) {
    final TreeParser parser = new TreeParser(newick);
    speciesTree.assignFromWithoutID(parser);
    System.out.println(speciesTree.toString());
}
 
开发者ID:genomescale,项目名称:starbeast2,代码行数:6,代码来源:StarBeastInitializer.java

示例3: sample

import beast.evolution.tree.Tree; //导入方法依赖的package包/类
/**
 * Sampling only implemented for no-origin case currently.
 */
@Override
public void sample(State state, Random random) {

    if (sampledFlag)
        return;

    sampledFlag = true;

    // Cause conditional parameters to be sampled

    sampleConditions(state, random);

    Tree tree = (Tree) treeInput.get();
    RealParameter birthRate = birthDiffRateParameterInput.get();

    // Simulate tree conditional on new parameters

    List<Node> activeLineages = new ArrayList<>();
    for (Node oldLeaf : tree.getExternalNodes()) {
        Node newLeaf = new Node(oldLeaf.getID());
        newLeaf.setNr(oldLeaf.getNr());
        newLeaf.setHeight(0.0);
        activeLineages.add(newLeaf);
    }

    int nextNr = activeLineages.size();

    double t = 0.0;
    while (activeLineages.size() > 1) {
        int k = activeLineages.size();
        double a = birthRate.getValue() * k;

        t += -Math.log(random.nextDouble())/a;

        Node node1 = activeLineages.get(random.nextInt(k));
        Node node2;
        do {
            node2 = activeLineages.get(random.nextInt(k));
        } while (node2.equals(node1));

        Node newParent = new Node();
        newParent.setNr(nextNr++);
        newParent.setHeight(t);
        newParent.addChild(node1);
        newParent.addChild(node2);

        activeLineages.remove(node1);
        activeLineages.remove(node2);
        activeLineages.add(newParent);
    }

    tree.assignFromWithoutID(new Tree(activeLineages.get(0)));
}
 
开发者ID:CompEvol,项目名称:beast2,代码行数:57,代码来源:YuleModel.java


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