本文整理汇总了Java中pal.tree.Node.getNumber方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getNumber方法的具体用法?Java Node.getNumber怎么用?Java Node.getNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pal.tree.Node
的用法示例。
在下文中一共展示了Node.getNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printlnNodeWithNumberAndLabel
import pal.tree.Node; //导入方法依赖的package包/类
private static void printlnNodeWithNumberAndLabel(PrintWriter out, Node node, int level,
int numExternalNodes, boolean[] umbrella, int[] position) {
for (int i = 0; i < level - 1; i++) {
if (umbrella[i]) {
putCharAtLevel(out, i, '|', position);
} else {
putCharAtLevel(out, i, ' ', position);
}
}
putCharAtLevel(out, level - 1, '+', position);
int branchNumber;
if (node.isLeaf()) {
branchNumber = node.getNumber() + 1;
} else {
branchNumber = node.getNumber() + 1 + numExternalNodes;
}
String numberAsString = Integer.toString(branchNumber);
int numDashs = position[level] - numberAsString.length();
for (int i = 0; i < numDashs ; i++) {
out.print('-');
}
out.print(numberAsString);
if (node.isLeaf()) {
out.println(" " + node.getIdentifier());
} else {
if (!node.getIdentifier().equals(Identifier.ANONYMOUS)) {
out.print("(" + node.getIdentifier() + ")");
}
out.println();
}
}
示例2: scaleConditionals
import pal.tree.Node; //导入方法依赖的package包/类
private void scaleConditionals(Node node, double[] conditionals) {
if (node.getNumber() % Constants.SCALING_NODE_STEP == 0) {
// only scale if all entries in conditional are less than threshold
for (double c : conditionals)
if (c > Constants.SCALING_THRESHOLD)
return;
for (int i = 0; i < conditionals.length; i++) {
conditionals[i] /= Constants.SCALING_THRESHOLD;
}
scaledPartial.add(Constants.SCALING_THRESHOLD);
scaledNodes.add(node.getNumber());
}
}
示例3: getBranchNumber
import pal.tree.Node; //导入方法依赖的package包/类
private int getBranchNumber(Node n) {
return (n.isLeaf() ? 0 : trees[0].getExternalNodeCount()) + n.getNumber();
}
示例4: printlnNodeWithNumberAndLabel
import pal.tree.Node; //导入方法依赖的package包/类
private static void printlnNodeWithNumberAndLabel(PrintWriter out, Node node, int level,
int numExternalNodes, boolean[] umbrella, int[] position) {
for (int i = 0; i < level - 1; i++) {
if (umbrella[i]) {
putCharAtLevel(out, i, '|', position);
} else {
putCharAtLevel(out, i, ' ', position);
}
}
putCharAtLevel(out, level - 1, '+', position);
int branchNumber;
if (node.isLeaf()) {
branchNumber = node.getNumber() + 1;
} else {
branchNumber = node.getNumber() + 1 + numExternalNodes;
}
String numberAsString = Integer.toString(branchNumber);
int numDashs = position[level] - numberAsString.length();
// String cladeSupport = "";
// if (node instanceof AttributeNode && ((AttributeNode)node).getAttribute(TreeUtils.TREE_CLADE_SUPPORT_ATTRIBUTE) != null) {
// double cladeSupportValue = (Double) ((AttributeNode)node).getAttribute(TreeUtils.TREE_CLADE_SUPPORT_ATTRIBUTE);
// cladeSupport = ProtTestFormattedOutput.getDecimalString(cladeSupportValue, 1);
// }
//
// numDashs -= cladeSupport.length();
for (int i = 0; i < numDashs ; i++) {
out.print('-');
}
out.print(numberAsString);
if (node.isLeaf()) {
out.println(" " + node.getIdentifier());
} else {
if (!node.getIdentifier().equals(Identifier.ANONYMOUS)) {
out.print("(" + node.getIdentifier() + ")");
}
out.println();
}
}
示例5: downTree
import pal.tree.Node; //导入方法依赖的package包/类
private double[] downTree() {
//long start = CodeTimer.start();
for (Node node : nodeTraversalOrder) {
double[] conditional = new double[GeneticCode.CODON_STATES];
for (int j : senseCodons) conditional[j] = 1.0;
for (int j = 0; j < node.getChildCount(); j++) {
Node child = node.getChild(j);
double[] lowerConditional;
if (child.isLeaf()) {
if (GeneticCode.getInstance().isUnknownCodonState(states.get(getNodeLabel(child)))) {
lowerConditional = gapConditional;
} else {
Arrays.fill(tipConditional, 0.0);
tipConditional[states.get(getNodeLabel(child))] = 1.0;
lowerConditional = tipConditional;
}
} else {
lowerConditional = conditionals[child.getNumber()];
}
if (node.isRoot()) {
conditionalAtRoot.add(new Partial(child, PhyloUtils.getNodeNumber(tree, child), Arrays.copyOf(lowerConditional, GeneticCode.CODON_STATES), child.getBranchLength()));
}
if (cladeModels.size() == 1) { // homogeneous model
// TODO: A probability matrix (of sorts) already exists in TdGCodonModel...do we need to create it again?
// cladeCalculators.get(ROOT_MODEL_NAME).getTransitionProbabilities(probMatrix, child.getBranchLength());
// updateIntraCladeConditionals(lowerConditional, conditional, probMatrix);
cladeCalculators.get(ROOT_MODEL_NAME).calculatePartialLikelihood(lowerConditional, conditional, child.getBranchLength());
} else { // non-homogeneous model
if (getNodeLabel(node).length() == 0 // the root of the tree is a parent without a label
|| getNodeLabel(child).substring(0, 2).equals(getNodeLabel(node).substring(0, 2))) { // or we're not switching to a different model
cladeCalculators.get(getNodeLabel(child).substring(0, 2)).getTransitionProbabilities(probMatrix, child.getBranchLength());
updateIntraCladeConditionals(lowerConditional, conditional, probMatrix);
} else { // this is a hostshift!
final double[][] probMatrix1 = new double[GeneticCode.CODON_STATES][GeneticCode.CODON_STATES];
cladeCalculators.get(getNodeLabel(node).substring(0, 2)).getTransitionProbabilities(probMatrix, child.getBranchLength() * Constants.CLADE_BRANCH_SPLIT);
cladeCalculators.get(getNodeLabel(child).substring(0, 2)).getTransitionProbabilities(probMatrix1, child.getBranchLength() * (1 - Constants.CLADE_BRANCH_SPLIT));
updateInterCladeConditionals(lowerConditional, conditional, probMatrix, probMatrix1);
}
}
}
// don't scale the root node
if (!node.isRoot()) {
scaleConditionals(node, conditional);
}
conditionals[node.getNumber()] = conditional;
}
return conditionals[tree.getRoot().getNumber()];
}