X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=treegroupscommand.cpp;fp=treegroupscommand.cpp;h=b793dc885ef9213f290f118be55066a0e2837086;hp=0df53d5649881c924be60140338e5fff7c2bc840;hb=01d5a60fc5f396339acf529151fa8186ee7c1a41;hpb=567e4bca5d62bd8ea316ce5def320d070d7507b8 diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 0df53d5..b793dc8 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -644,6 +644,7 @@ int TreeGroupCommand::makeSimsShared() { }else { m->clearGroups(); Groups.clear(); + m->Treenames.clear(); vector temp; for (int i = 0; i < lookup.size(); i++) { if (lookup[i]->getNumSeqs() < subsampleSize) { @@ -652,6 +653,7 @@ int TreeGroupCommand::makeSimsShared() { }else { Groups.push_back(lookup[i]->getGroup()); temp.push_back(lookup[i]); + m->Treenames.push_back(lookup[i]->getGroup()); } } lookup = temp; @@ -917,11 +919,15 @@ int TreeGroupCommand::process(vector thisLookup) { for (int i = 0; i < calcDists.size(); i++) { calcDists[i].clear(); } } } - + + if (m->debug) { m->mothurOut("[DEBUG]: done with iters.\n"); } + if (iters != 1) { //we need to find the average distance and standard deviation for each groups distance vector< vector > calcAverages = m->getAverages(calcDistsTotals); + if (m->debug) { m->mothurOut("[DEBUG]: found averages.\n"); } + //create average tree for each calc for (int i = 0; i < calcDists.size(); i++) { vector< vector > matrix; //square matrix to represent the distance @@ -951,6 +957,8 @@ int TreeGroupCommand::process(vector thisLookup) { if (newTree != NULL) { writeTree(outputFile, newTree); } } + if (m->debug) { m->mothurOut("[DEBUG]: done averages trees.\n"); } + //create all trees for each calc and find their consensus tree for (int i = 0; i < calcDists.size(); i++) { if (m->control_pressed) { break; } @@ -982,7 +990,7 @@ int TreeGroupCommand::process(vector thisLookup) { int row = calcDistsTotals[myIter][i][j].seq1; int column = calcDistsTotals[myIter][i][j].seq2; double dist = calcDistsTotals[myIter][i][j].dist; - + matrix[row][column] = dist; matrix[column][row] = dist; } @@ -997,11 +1005,15 @@ int TreeGroupCommand::process(vector thisLookup) { outAll.close(); if (m->control_pressed) { for (int k = 0; k < trees.size(); k++) { delete trees[k]; } } + if (m->debug) { m->mothurOut("[DEBUG]: done all trees.\n"); } + Consensus consensus; //clear old tree names if any m->Treenames.clear(); m->Treenames = m->getGroups(); //may have changed if subsample eliminated groups Tree* conTree = consensus.getTree(trees); + if (m->debug) { m->mothurOut("[DEBUG]: done cons tree.\n"); } + //create a new filename variables["[tag]"] = "cons"; string conFile = getOutputFileName("tree",variables);