Ejemplo n.º 1
0
 void setStateRecursive(RootedTree tree, PhyloNode base, int state) {
   BreadthFirstIterator bfi = new BreadthFirstIterator(tree, base);
   while (bfi.hasNext()) {
     PhyloNode n = (PhyloNode) bfi.next();
     n.setState(state);
   }
 }
Ejemplo n.º 2
0
 void setPositionRecursive(RootedTree tree, PhyloNode base, PhyloNode positionToMe) {
   BreadthFirstIterator bfi = new BreadthFirstIterator(tree, base);
   while (bfi.hasNext()) {
     PhyloNode n = (PhyloNode) bfi.next();
     n.setPosition(positionToMe);
   }
 }
Ejemplo n.º 3
0
 void clearCutNodes() {
   if (origTree != null) {
     if (origVertex != null && origVertex.getState() == PhyloNode.CUT) {
       origTree.deleteSubtree(origVertex);
       origTree.removeElbowsBelow(origTree.getRoot());
       setStateRecursive(origTree, (PhyloNode) origTree.getRoot(), PhyloNode.NONE);
       origVertex.found = false;
       origVertex = null;
       origTree.modPlus();
     }
   }
 }
Ejemplo n.º 4
0
  public synchronized void paste(CachedRootedTree destTree, PhyloNode destNode) {
    // Translate the newick string into a RooteTree.
    PhyloTree tree = loadClip();
    // Add the clone's vertices and edges to the destination tree.

    synchronized (destTree) {
      destTree.setHoldCalculations(true);
      Graphs.addGraph(destTree, tree);
      // Insert the clone's root vertex into the midpoint above destNode.
      if (destTree.getParentOf(destNode) == null) {
        destTree.addEdge(destNode, tree.getRoot());
      } else {
        DefaultVertex internalVertex = destTree.createAndAddVertex();
        ((PhyloNode) internalVertex).setPosition(origVertex);
        destTree.insertNodeBetween(destTree.getParentOf(destNode), destNode, internalVertex);
        destTree.addEdge(internalVertex, tree.getRoot());
      }
      destTree.setHoldCalculations(false);
      destTree.modPlus();

      clearCutNodes();
    }
  }