X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=treegroupscommand.cpp;h=0df53d5649881c924be60140338e5fff7c2bc840;hb=1f0e54b53b714781f3f2fee7d01177fade98a625;hp=90d336da38f57f70fa0f5ddb59125cc2099ec346;hpb=deba0af0ccdcb6005ed5b2b82649b137c63fbdf7;p=mothur.git diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index 90d336d..0df53d5 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -429,7 +429,10 @@ int TreeGroupCommand::execute(){ m->Treenames.clear(); //fills globaldatas tree names - m->Treenames = m->getGroups(); + //m->Treenames = m->getGroups(); + for (int k = 0; k < lookup.size(); k++) { + m->Treenames.push_back(lookup[k]->getGroup()); + } if (m->control_pressed) { return 0; } @@ -463,7 +466,10 @@ int TreeGroupCommand::execute(){ list = readMatrix->getListVector(); SparseDistanceMatrix* dMatrix = readMatrix->getDMatrix(); - + + //clear globaldatas old tree names if any + m->Treenames.clear(); + //make treemap if (ct != NULL) { delete ct; } ct = new CountTable(); @@ -475,17 +481,12 @@ int TreeGroupCommand::execute(){ nameMap.insert(bin); gps.insert(bin); groupMap[bin] = bin; + m->Treenames.push_back(bin); } ct->createTable(nameMap, groupMap, gps); vector namesGroups = ct->getNamesOfGroups(); m->setGroups(namesGroups); - - //clear globaldatas old tree names if any - m->Treenames.clear(); - - //fills globaldatas tree names - m->Treenames = m->getGroups(); //used in tree constructor m->runParse = false; @@ -889,6 +890,9 @@ int TreeGroupCommand::process(vector thisLookup) { //Close all thread handles and free memory allocations. for(int i=0; i < pDataArray.size(); i++){ + if (pDataArray[i]->count != (pDataArray[i]->end-pDataArray[i]->start)) { + m->mothurOut("[ERROR]: process " + toString(i) + " only processed " + toString(pDataArray[i]->count) + " of " + toString(pDataArray[i]->end-pDataArray[i]->start) + " groups assigned to it, quitting. \n"); m->control_pressed = true; + } for (int j = 0; j < pDataArray[i]->thisLookup.size(); j++) { delete pDataArray[i]->thisLookup[j]; } for (int k = 0; k < calcDists.size(); k++) { @@ -916,31 +920,7 @@ int TreeGroupCommand::process(vector thisLookup) { if (iters != 1) { //we need to find the average distance and standard deviation for each groups distance - - vector< vector > calcAverages; calcAverages.resize(treeCalculators.size()); - for (int i = 0; i < calcAverages.size(); i++) { //initialize sums to zero. - calcAverages[i].resize(calcDistsTotals[0][i].size()); - - for (int j = 0; j < calcAverages[i].size(); j++) { - calcAverages[i][j].seq1 = calcDists[i][j].seq1; - calcAverages[i][j].seq2 = calcDists[i][j].seq2; - calcAverages[i][j].dist = 0.0; - } - } - - for (int thisIter = 0; thisIter < iters; thisIter++) { //sum all groups dists for each calculator - for (int i = 0; i < calcAverages.size(); i++) { //initialize sums to zero. - for (int j = 0; j < calcAverages[i].size(); j++) { - calcAverages[i][j].dist += calcDistsTotals[thisIter][i][j].dist; - } - } - } - - for (int i = 0; i < calcAverages.size(); i++) { //finds average. - for (int j = 0; j < calcAverages[i].size(); j++) { - calcAverages[i][j].dist /= (float) iters; - } - } + vector< vector > calcAverages = m->getAverages(calcDistsTotals); //create average tree for each calc for (int i = 0; i < calcDists.size(); i++) {