Tabnine Logo
TreeNode.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
phylo.tree.model.TreeNode
constructor

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

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

/**
 * If not done allready, this creates a new TreeNode 
 * representing this bipartiton. This is used to create 
 * the consensus tree in the NConsensus Algorithm
 * 
 * @param tree the Tree for the node
 * @return TreeNode the node
 */
public TreeNode getNode(Tree tree, double count) {
  if(node == null){
    node = new TreeNode();
    tree.addVertex(node);
    if(label != null)
      node.setLabel(label);
    else if (count >= 0d)
      node.setLabel(Double.toString(count));
  }
  return node;		
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

/**
 * Clones this node.
 *
 * @return node the new node
 */
public TreeNode cloneNode() {
  TreeNode n = new TreeNode();
  n.setLabel(getLabel());
  n.setIndex(getIndex());
  return n;
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.consensus

private Tree addCompatibleCladesToBackboneTree(Tree backboneTree, Collection<Bipartition> partitionsToInsert) {
  for (Bipartition partition : partitionsToInsert) {
    Set<TreeNode> leafes = new HashSet<>();
    for (int i = partition.partition.nextSetBit(0); i >= 0; i = partition.partition.nextSetBit(i + 1)) {
      leafes.add(indexToLeaf1.get(i));
    }
    TreeNode lca = backboneTree.findLeastCommonAncestor(new ArrayList<>(leafes));
    TreeNode nuLca = new TreeNode();
    backboneTree.addVertex(nuLca);
    for (TreeNode child : lca.getChildren()) {
      TreeNode leaf;
      if (child.isInnerNode()) {
        leaf = child.depthFirstIterator().iterator().next();
      } else {
        leaf = child;
      }
      if (leafes.contains(leaf)) {
        backboneTree.removeEdge(lca, child);
        backboneTree.addEdge(nuLca, child);
      }
    }
    backboneTree.addEdge(lca, nuLca);
  }
  return backboneTree;
}
origin: de.unijena.bioinf.phylo/flipcut-lib.beam-search

public Tree buildTree() {
  TIntObjectMap<TreeNode> nodeMap = new TIntObjectHashMap<>();
  Tree tree = new Tree();
  Iterator<Edge> it = supertreeEdges.iterator();
  while (it.hasNext()) {
    Edge edge = it.next();
    nodeMap.put(edge.treeNode, new TreeNode(edge.treeNodeLabel));
    tree.addVertex(nodeMap.get(edge.treeNode));
    if (edge.parentNode == 0) {
      tree.setRoot(nodeMap.get(edge.treeNode));
      it.remove();
    }
  }
  for (Edge edge : supertreeEdges) {
    tree.addEdge(nodeMap.get(edge.parentNode), nodeMap.get(edge.treeNode));
  }
  tree.setName(String.valueOf(currentscore));
  return tree;
}
origin: de.unijena.bioinf.phylo/gscm-lib

TreeNode nuLcaParent = new TreeNode();
t.addVertex(nuLcaParent);
t.addEdge(nuLcaParent, lca);
TreeNode nuLcaParent = new TreeNode();
t.addVertex(nuLcaParent);
t.addEdge(nuLcaParent, lca);
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

  if (lca == null || lca == tree.getRoot()) {
    TreeNode newRoot = new TreeNode();
    tree.addVertex(newRoot);
    tree.addEdge(newRoot, tree.getRoot());
  } else {
    parent = new TreeNode();
    tree.addVertex(parent);
    TreeNode lcaParent = lca.getParent();
if (!singleTaxon.subtree.endsWith(";")) {
  newNode = new TreeNode(singleTaxon.subtree);
  tree.addVertex(newNode);
  tree.addEdge(parent, newNode);
origin: de.unijena.bioinf.phylo/phyloTree-lib.consensus

  id = p[i].getLeavesIterator().next();
  newNode = new TreeNode(id.toString());
  result.addVertex(newNode);
  result.addEdge(node, newNode);
case 2:
  newNode = new TreeNode();
  result.addVertex(newNode);
  result.addEdge(node, newNode);
    id = it.next();
    TreeNode l = new TreeNode(id.toString());//n2.getLabel());
    result.addVertex(l);
    result.addEdge(newNode, l);
default:
  newNode = new TreeNode();
  result.addVertex(newNode);
  result.addEdge(node, newNode);
origin: de.unijena.bioinf.phylo/phyloTree-lib.utils

TreeNode root = new TreeNode();
tree.addVertex(root);
tree.addEdge(root, oldRoot);
    TreeNode nn = new TreeNode(s);
    tree.addVertex(nn);
    tree.addEdge(root, nn);
TreeNode np = new TreeNode();
tree.addVertex(np);
tree.addEdge(p, np);
  TreeNode nn = new TreeNode(s);
  tree.addVertex(nn);
  tree.addEdge(np, nn);
TreeNode root = new TreeNode();
tree.addVertex(root);
tree.setRoot(root);
for (String s : merged) {
  TreeNode nn = new TreeNode(s);
  tree.addVertex(nn);
  tree.addEdge(root, nn);
  TreeNode old = new TreeNode(root.getLabel());
  root.setLabel(null);
  tree.addVertex(old);
  tree.addEdge(root, old);
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

StringBuffer label = new StringBuffer();
StringBuffer nhx = new StringBuffer();
TreeNode n = new TreeNode();
TreeNode x = new TreeNode();
t.addVertex(x);
t.addVertex(n);
        switch (st.ttype) {
          case '(':
            c = new TreeNode();
            t.addVertex(c);
            t.addEdge(n, c);
            c = new TreeNode();
            t.addVertex(c);
            t.addEdge(n.getParent(), c);
origin: de.unijena.bioinf.phylo/phyloTree-lib.consensus

TreeNode nuLca = new TreeNode();
t1.addVertex(nuLca);
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

TreeNode e2 = current.getChildren().get(i);
TreeNode newNode = new TreeNode();
TreeNode e2 = list.get(1);
TreeNode newNode = new TreeNode();
tree.addVertex(newNode);
TreeNode newNode = new TreeNode();
tree.addVertex(newNode);
origin: de.unijena.bioinf.phylo/phyloTree-lib.consensus

TreeNode cRoot = new TreeNode();
result.addVertex(cRoot);
result.setRoot(cRoot);
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);
}
origin: de.unijena.bioinf.phylo/phyloTree-lib.model

protected static boolean pruneTraverse(Tree t, TreeNode n, TreeNode parent, Set<String> labels) {
  if (n.isLeaf()) {
    if (n.getLabel() != null && labels.contains(n.getLabel())) {
      TreeNode newNode = new TreeNode(n.getLabel());
    TreeNode newNode = new TreeNode();
    newNode.setLabel(n.getLabel());
phylo.tree.modelTreeNode<init>

Javadoc

Create a new node

Popular methods of TreeNode

  • 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.
  • getLeaves
    Returns the leaves under this node in depths first traversal order.
  • getDistanceToParent,
  • getLeaves,
  • setLabel,
  • cloneNode,
  • equalsNode,
  • getChildAt,
  • getGraph,
  • getIndex,
  • getPartition

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Top Sublime Text 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