本文整理汇总了Java中jebl.evolution.trees.SimpleRootedTree类的典型用法代码示例。如果您正苦于以下问题:Java SimpleRootedTree类的具体用法?Java SimpleRootedTree怎么用?Java SimpleRootedTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleRootedTree类属于jebl.evolution.trees包,在下文中一共展示了SimpleRootedTree类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToJebl
import jebl.evolution.trees.SimpleRootedTree; //导入依赖的package包/类
private static Node convertToJebl(Tree tree, NodeRef node, SimpleRootedTree jtree) {
if (tree.isExternal(node)) {
String taxonId = tree.getTaxonId(node.getNumber());
Node externalNode = jtree.createExternalNode(jebl.evolution.taxa.Taxon.getTaxon(taxonId));
jtree.setHeight(externalNode, tree.getNodeHeight(node));
return externalNode;
}
List<Node> jchildren = new ArrayList<Node>();
for (int nc = 0; nc < tree.getChildCount(node); ++nc) {
NodeRef child = tree.getChild(node, nc);
Node node1 = convertToJebl(tree, child, jtree);
jtree.setHeight(node1, tree.getNodeHeight(child));
jchildren.add(node1);
}
return jtree.createInternalNode(jchildren);
}
示例2: convertToJebl
import jebl.evolution.trees.SimpleRootedTree; //导入依赖的package包/类
default Node convertToJebl(NodeRef node, SimpleRootedTree jtree) {
if (isExternal(node)) {
String taxonId = getTaxonId(node.getNumber());
Node externalNode = jtree.createExternalNode(jebl.evolution.taxa.Taxon.getTaxon(taxonId));
jtree.setHeight(externalNode, getNodeHeight(node));
return externalNode;
}
List<Node> jchildren = new ArrayList<Node>();
for (int nc = 0; nc < getChildCount(node); ++nc) {
NodeRef child = getChild(node, nc);
Node node1 = convertToJebl(child, jtree);
jtree.setHeight(node1, getNodeHeight(child));
jchildren.add(node1);
}
return jtree.createInternalNode(jchildren);
}
示例3: asJeblTree
import jebl.evolution.trees.SimpleRootedTree; //导入依赖的package包/类
/**
* Convert from beast tree to JEBL tree.
* Note that currently only topology and branch lengths are preserved.
* Can add attributes later if needed.
*
* @return jebl tree
*/
default SimpleRootedTree asJeblTree() {
SimpleRootedTree jtree = new SimpleRootedTree();
convertToJebl(getRoot(), jtree);
jtree.setHeight(jtree.getRootNode(), getNodeHeight(getRoot()));
return jtree;
}
示例4: asJeblTree
import jebl.evolution.trees.SimpleRootedTree; //导入依赖的package包/类
/**
* Convert from beast tree to JEBL tree.
* Note that currently only topology and branch lengths are preserved.
* Can add attributes later if needed.
*
* @param tree beast
* @return jebl tree
*/
static public SimpleRootedTree asJeblTree(Tree tree) {
SimpleRootedTree jtree = new SimpleRootedTree();
convertToJebl(tree, tree.getRoot(), jtree);
jtree.setHeight(jtree.getRootNode(), tree.getNodeHeight(tree.getRoot()));
return jtree;
}