Tabnine Logo
TreeUtils.pruneDegreeOneNodes
Code IndexAdd Tabnine to your IDE (free)

How to use
pruneDegreeOneNodes
method
in
phylo.tree.model.TreeUtils

Best Java code snippets using phylo.tree.model.TreeUtils.pruneDegreeOneNodes (Showing top 10 results out of 315)

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

/**
 * Iterates over the tree and removes all inner vertices with outdegree == 1.
 * The resulting tree is at least binary.
 *
 * @param tree the tree
 */
public static void pruneDegreeOneNodes(Tree tree) {
  pruneDegreeOneNodes(tree, true, false);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

public static void pruneDegreeOneNodes(Tree tree, boolean sumEdgeWeight) {
  pruneDegreeOneNodes(tree, sumEdgeWeight, false);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

public static void keepLeafesAndPruneTree(Tree tree, Collection<TreeNode> toKeep) {
  boolean deleted = true;
  while (deleted) {
    deleted = false;
    for (TreeNode node : tree.getLeaves()) {
      if (node.getLabel() == null || !toKeep.contains(node)) {
        tree.removeVertex(node);
        deleted = true;
      }
    }
  }
  pruneDegreeOneNodes(tree);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

TreeUtils.pruneDegreeOneNodes(supertree);
int innernodesAfter = supertree.vertexCount() - supertree.getNumTaxa();
System.out.println("--------------> " + modifiedCharacters + "clades modified");
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

/**
 * remove the taxon with the given label and prune the tree
 *
 * @param merge merge label
 * @param taxa  the taxa
 * @param trees pruned trees
 */
protected void removeAndPrune(String merge, List<String> taxa, List<Tree> trees) {
  for (Tree tree : trees) {
    for (TreeNode node : tree.vertices()) {
      if (node.getLabel() != null && taxa.contains(node.getLabel()) && !node.getLabel().equals(merge)) {
        // remove
        TreeNode parent = node.getParent();
        tree.removeVertex(node);
      }
    }
    TreeUtils.pruneDegreeOneNodes(tree, sumEdgeWeightsWhenPruning, USE_PARENT_WEIGHT);
  }
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

public static void removeSubtreeFromTree(List<TreeNode> toRemove, Tree tree, boolean sumEdgeWeight, boolean useParentWeight) {
  // remove
  for (TreeNode treeNode : toRemove) {
    if (treeNode.isLeaf()) {
      tree.removeVertex(treeNode);
    } else {
      List<TreeNode> subtreeNodes = new ArrayList<TreeNode>();
      // remove complete subtree
      for (TreeNode node : treeNode.depthFirstIterator()) {
        subtreeNodes.add(node);
      }
      for (TreeNode subtreeNode : subtreeNodes) {
        tree.removeVertex(subtreeNode);
      }
      tree.removeVertex(treeNode);
    }
  }
  // remove leaves with no labels
  List<TreeNode> inner = new ArrayList<TreeNode>();
  for (TreeNode treeNode : tree.vertices()) {
    if (treeNode.isLeaf() && (treeNode.getLabel() == null || treeNode.getLabel().length() == 0)) {
      inner.add(treeNode);
    }
  }
  for (TreeNode treeNode : inner) {
    tree.removeVertex(treeNode);
  }
  // prune the tree
  pruneDegreeOneNodes(tree, sumEdgeWeight, useParentWeight);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

pruneDegreeOneNodes(tree);
origin: de.unijena.bioinf.phylo/phyloTree-lib.consensus

TreeUtils.pruneDegreeOneNodes(result);
origin: de.unijena.bioinf.phylo/gscm-lib

  TreeUtils.pruneDegreeOneNodes(t, false, false);
} else {
  for (TreeNode child : node.children()) {
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Reroot tree with the new root placed at the incomming edge of the given outgroup
 *
 * @param tree     the tree
 * @param outgroup the outgroup taxon
 */
public static void rerootToOutgroup(Tree tree, TreeNode outgroup, double edgeLengthToOutgroup) {
  TreeNode parent = outgroup.getParent();
  if (parent == null) return;
  TreeNode newRoot = new TreeNode();
  // add outgroup to new root
  tree.addVertex(newRoot);
  double oldWeight = tree.getEdge(parent, outgroup).getWeight();
  tree.removeEdge(parent, outgroup);
  final Edge<TreeNode> edge = tree.addEdge(newRoot, outgroup);
  edge.setWeight(edgeLengthToOutgroup);
  // connect parent
  connectParent(tree, newRoot, parent, oldWeight - edgeLengthToOutgroup);
  tree.setRoot(newRoot);
  pruneDegreeOneNodes(tree);
}
phylo.tree.modelTreeUtilspruneDegreeOneNodes

Javadoc

Iterates over the tree and removes all inner vertices with outdegree == 1. The resulting tree is at least binary.

Popular methods of TreeUtils

  • getLeafLabels
    The set of labels of all leafs below the input tree node
  • commonLeaves
    Returns the list of leaves contained in all trees
  • deleteInnerLabels
    Clones all trees and removes all innter vertex labels from the clones. The given source trees are no
  • getChildrenMap
  • pruneInnerNode
    Deletes the specified node from the tree.The child of this node becomes child of its parent. If the
  • removeSubtreeFromTree
  • reorderingBootstrapLabelsForRooting
  • rerootToOutgroup
    Reroot tree with the new root placed at the incomming edge of the given outgroup
  • addLeafesFromChildren
  • buildFitchUnion
  • calculateTreeResolution
  • checkForChilds
  • calculateTreeResolution,
  • checkForChilds,
  • cloneAndPruneTrees,
  • connectParent,
  • containsInnerLabels,
  • deleteRootNode,
  • findAndMergeDuplicates,
  • flipLeaves,
  • getLeafesFromLabels

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • String (java.lang)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JCheckBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top PhpStorm 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