X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=tree.cpp;h=44ecadd534b60d60b602d9e052259ac69709f9d3;hb=5a4ac4f954c4b4445bcee272f1f8220ddcc9c1e4;hp=d9b4a9c1e8f4e31475aa5127adb38d339d1a8631;hpb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;p=mothur.git diff --git a/tree.cpp b/tree.cpp index d9b4a9c..44ecadd 100644 --- a/tree.cpp +++ b/tree.cpp @@ -588,6 +588,37 @@ int Tree::populateNewTree(vector& oldtree, int node, int& index) { } } /*****************************************************************/ +void Tree::getCopy(Tree* copy, map nameMap) { + try { + + //for each node in the tree copy its info + for (int i = 0; i < numNodes; i++) { + //copy branch length + tree[i].setBranchLength(copy->tree[i].getBranchLength()); + + //copy parent + tree[i].setParent(copy->tree[i].getParent()); + + //copy children + tree[i].setChildren(copy->tree[i].getLChild(), copy->tree[i].getRChild()); + } + + if (nameMap.size() != 0) { addNamesToCounts(nameMap); } + + //build the pGroups in non leaf nodes to be used in the parsimony calcs. + for (int i = numLeaves; i < numNodes; i++) { + if (m->control_pressed) { break; } + + tree[i].pGroups = (mergeGroups(i)); + tree[i].pcount = (mergeGcounts(i)); + } + } + catch(exception& e) { + m->errorOut(e, "Tree", "getCopy"); + exit(1); + } +} +/*****************************************************************/ void Tree::getCopy(Tree* copy) { try {