Tabnine Logo
TreeNode.getLeaves
Code IndexAdd Tabnine to your IDE (free)

How to use
getLeaves
method
in
phylo.tree.model.TreeNode

Best Java code snippets using phylo.tree.model.TreeNode.getLeaves (Showing top 14 results out of 315)

origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Returns an array of all leaves.
 * <p>
 * This uses {@link TreeNode#getLeaves()} on
 * the root of the tree. Be sure the tree is completely initialized, because
 * we need a root node and {@link TreeNode#isLeaf()} is used to distinguish
 * between leaves and inner nodes, and this only works on a properly initialized tree.
 *
 * @return treeNodes array of all leaves in this tree
 * @since 0.8.2
 */
public TreeNode[] getLeaves() {
  return getRoot().getLeaves();
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

  private static Set<TreePartition> getPartitions(Tree tree, Set<String> allTaxa){
    Set<TreePartition> partitions = new HashSet<TreePartition>();
    for (TreeNode current : tree.vertices()) {
      if (current.isInnerNode()) {
//                if (!current.equals(calculated.getRoot())) {
        TreeNode[] leafes = current.getLeaves();
        if ((allTaxa.size() - leafes.length) > 1)
          partitions.add(new TreePartition(leafes, allTaxa));
//                }
      }
    }
    return partitions;
  }

origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

private List<String> labels(TreeNode n) {
  List<String> l = new ArrayList<String>();
  for (TreeNode node : n.getLeaves()) {
    if (node.getLabel() != null && node.getLabel().length() > 0) {
      l.add(n.getLabel());
    }
  }
  return l;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

public int compare(TreeNode o1, TreeNode o2) {
  String l1 = o1.getLabel();
  String l2 = o2.getLabel();
  if (l1 == null) {
    TreeNode[] leaves = o1.getLeaves();
    l1 = leaves[leaves.length - 1].getLabel();
  }
  if (l2 == null) {
    TreeNode[] leaves = o2.getLeaves();
    l2 = leaves[leaves.length - 1].getLabel();
  }
  return l1.compareTo(l2);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

private Map<TreeNode, Set<Object>> getNodeToLeafMap(Tree tree) {
  Map<TreeNode, Set<Object>> map = new HashMap<>(tree.getNumTaxa());
  for (TreeNode node : tree.vertices()) {
    if (node.isInnerNode()) {
      Set<Object> leafSet = new HashSet<>();
      for (TreeNode taxon : node.getLeaves()) {
        leafSet.add(nameToObject.get(taxon.getLabel()));
      }
      map.put(node, leafSet);
    }
  }
  return map;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

public PPCharacter(TreeNode character, Set<TreeNode> taxa) {
  TreeNode[] leafes = character.getLeaves();
  edges = new HashSet<>(leafes.length);
  imaginaryEdges = new HashSet<>(taxa.size() - leafes.length);
  for (TreeNode taxon : leafes) {
    if (!nameToObject.containsKey(taxon.getLabel()))
      nameToObject.put(taxon.getLabel(), new Object());
    edges.add(nameToObject.get(taxon.getLabel()));
    taxa.remove(taxon);
  }
  for (TreeNode taxon : taxa) {
    if (!nameToObject.containsKey(taxon.getLabel()))
      nameToObject.put(taxon.getLabel(), new Object());
    imaginaryEdges.add(nameToObject.get(taxon.getLabel()));
  }
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

for (TreeNode newchild : child.getLeaves()) {
  if (order.contains(newchild.getLabel())) {
    child = newchild;
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

final TreeNode[] leavesSubTree = nodeTree.getLeaves();
final TreeNode[] leavesSubCompareTree = nodeCompareTree.getLeaves();
String leaves = listLeaves(internalNodesTree.get(m).getLeaves());
System.out.print(leaves + "\t\t");
for (int n = 0; n < internalNodesCompareTree.size(); n++) {
String leaves = listLeaves(internalNodesTree.get(k).getLeaves());
System.out.print(leaves + "		");
for (int l = 0; l < internalNodesCompareTree.size(); l++) {
  } else {
    if (matrixDouble[a][b] == treeSet.getScore()) {
      if (computeBcn(internalNodesTree.get(a).getLeaves(), internalNodesCompareTree.get(b).getLeaves()) > computeBcn(treeSet.getNodeTree().getLeaves(), treeSet.getNodeCompareTree().getLeaves())) {
        treeSet.setNodeTree(internalNodesTree.get(a));
        treeSet.setNodeCompareTree(internalNodesCompareTree.get(b));
  } else {
    if (matrix[a][b].compareTo(treeSet.getScore2()) == 0) {
      if (computeBcn(internalNodesTree.get(a).getLeaves(), internalNodesCompareTree.get(b).getLeaves()) > computeBcn(treeSet.getNodeTree().getLeaves(), treeSet.getNodeCompareTree().getLeaves())) {
        treeSet.setNodeTree(internalNodesTree.get(a));
        treeSet.setNodeCompareTree(internalNodesCompareTree.get(b));
  } else {
    if (matrixDouble[b][a] == compareTreeSet.getScore()) {
      if (computeBcn(internalNodesTree.get(b).getLeaves(), internalNodesCompareTree.get(a).getLeaves()) > computeBcn(compareTreeSet.getNodeTree().getLeaves(), compareTreeSet.getNodeCompareTree().getLeaves())) {
        compareTreeSet.setNodeTree(internalNodesTree.get(b));
        compareTreeSet.setNodeCompareTree(internalNodesCompareTree.get(a));
origin: de.unijena.bioinf.phylo/flipcut-core

  edgeWeight = edgeWeight * (root.getLeaves().length - node.getLeaves().length);
} else if (weights == FlipCutWeights.Weights.EDGE_AND_ClADERATE) {
  edgeWeight = edgeWeight * (1 - (node.getLeaves().length / root.getLeaves().length));
} else if (weights == FlipCutWeights.Weights.ClADERATE) {
  edgeWeight = (1 - (node.getLeaves().length / root.getLeaves().length));
} else if (weights == FlipCutWeights.Weights.EDGE_AND_GLOBAL_ClADESIZE) {
  edgeWeight = edgeWeight * (taxaNumber - node.getLeaves().length);
} else if (weights == FlipCutWeights.Weights.CLADESIZE) {
  edgeWeight = root.getLeaves().length - node.getLeaves().length;
} else if (weights == FlipCutWeights.Weights.GLOBAL_CLADESIZE) {
  edgeWeight = taxaNumber - node.getLeaves().length;
  int leafesNumber = root.getLeaves().length;
  edgeWeight = (double) (leafesNumber - node.getLeaves().length) / leafesNumber;
} else if (weights == FlipCutWeights.Weights.EDGE_AND_RELATIVE_CLADESIZE) {
  int leafesNumber = root.getLeaves().length;
  edgeWeight = edgeWeight * ((double) (leafesNumber - node.getLeaves().length) / leafesNumber);
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

for (TreeNode leaf : tree.getRoot().getLeaves()) {
  String label = leaf.getLabel();
  if (label != null && label.length() > 0) {
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

for (TreeNode l : p.getLeaves()) { //TODO PROOF: fleisch thinks we need only the leaves of the siblings?
  String ll = l.getLabel();
  if (ll != null && ll.length() > 0) {
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

for (TreeNode leaf : node.getLeaves()) {
  if (leaf.equalsNode(a)) posA = x;
  if (leaf.equalsNode(b)) posB = x;
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

private int searchInComp(TreeNode originNode, Tree tree) { // einstieg in den zweiten  baum
  int retValue = 0;
  TreeNode found = null;
  TreeNode child = originNode.getLeaves()[0];
  if (findLeaf(child, 0)) {
    found = (TreeNode) searchForNode(tree, child);
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

public Edge getDistanceEdge(TreeNode source, TreeNode target) {
  int intersection = 0;
  double s = 0;
  for (TreeNode treeNodeSource : source.getPartition()
      .getLeavesArray()) {
    for (TreeNode treeNodeTarget : target.getPartition()
        .getLeavesArray()) {
      if (treeNodeSource.getLabel().equals(
          treeNodeTarget.getLabel())) {
        // if (treeNodeSource.equals(treeNodeTarget)){
        intersection++;
      }
    }
  }
  // //System.out.println("getDistance Methode likelihoods: intersection --> "+intersection);
  TreeNode getRootHelp = source;
  while (getRootHelp.getParent() != null) {
    getRootHelp = getRootHelp.getParent();
  }
  int allLeaves = getRootHelp.getLeaves().length;
  s = BCNWithLikelihoods.computeValueWithDouble(allLeaves, source
          .getPartition().getSize(), target.getPartition().getSize(),
      intersection);
  return new Edge(source, target, s);
}
phylo.tree.modelTreeNodegetLeaves

Javadoc

Returns the leaves under this node in depths first traversal order.

Popular methods of TreeNode

  • <init>
    Create a new node with given label
  • childCount
    Returns the number of children of this node.
  • depthFirstIterator
    Returns a depth first Iterable. This enables iterating the subtree rooted at this node in post order
  • getLabel
    The label of this node. If the label is not set, this looks for a label property TreeNodeProperties#
  • getParent
    Return the parent of this node.
  • isInnerNode
    Returns true if this is not a leaf.
  • isLeaf
    Returns true if this node is a leaf.
  • children
    Returns an Iterable over all children of this node. This allow using nodes in foreach loop: for(Tre
  • getChildren
    Get a list of all children of this node. It is helpful if one wants to iterate over all children and
  • getEdgeToParent
    Return the edge to the parent node or null.
  • getLevel
    Lazy and one time computation of the level of this node.
  • getDistanceToParent
    Returns the distance to the parent node. If the node has no parent (root node ) -1 is returned.
  • getLevel,
  • getDistanceToParent,
  • setLabel,
  • cloneNode,
  • equalsNode,
  • getChildAt,
  • getGraph,
  • getIndex,
  • getPartition

Popular in Java

  • Creating JSON documents from java classes using gson
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JList (javax.swing)
  • JOptionPane (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now