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


Java Node.getNumber方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:ddarriba,项目名称:jmodeltest2,代码行数:38,代码来源:TreeUtilities.java

示例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());
    }
}
 
开发者ID:tamuri,项目名称:swmutsel,代码行数:16,代码来源:LikelihoodCalculator.java

示例3: getBranchNumber

import pal.tree.Node; //导入方法依赖的package包/类
private int getBranchNumber(Node n) {
    return (n.isLeaf() ? 0 : trees[0].getExternalNodeCount()) + n.getNumber();
}
 
开发者ID:baezortega,项目名称:mutree,代码行数:4,代码来源:ParseRST.java

示例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();
        }
    }
 
开发者ID:ddarriba,项目名称:prottest3,代码行数:46,代码来源:TreeUtils.java

示例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()];
}
 
开发者ID:tamuri,项目名称:swmutsel,代码行数:65,代码来源:LikelihoodCalculator.java


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