示例#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);
   }
 }
示例#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);
   }
 }
示例#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();
     }
   }
 }
示例#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();
    }
  }