X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rarefact.cpp;h=cb4bbbce9a4047ae08b5f37b807be3f78c255d89;hb=599af78a6ea4916919d460a131e2d0dffa28d35e;hp=e776393b47318e8a7f9b79016433f75a8ba049d9;hpb=8c548985e92f5be0bde10eddea89a6ae888b73da;p=mothur.git diff --git a/rarefact.cpp b/rarefact.cpp index e776393..cb4bbbc 100644 --- a/rarefact.cpp +++ b/rarefact.cpp @@ -8,7 +8,7 @@ */ #include "rarefact.h" -#include "ordervector.hpp" +//#include "ordervector.hpp" /***********************************************************************/ @@ -52,11 +52,15 @@ void Rarefact::getCurve(int increment = 1, int nIters = 1000){ for(int i=0;ireset(); } + + delete lookup; + delete rank; } for(int i=0;iclose(); } + delete rcd; } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the Rarefact class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -85,10 +89,10 @@ try { lookup.clear(); //create and initialize vector of sharedvectors, one for each group - for (int i = 0; i < globaldata->gGroupmap->getNumGroups(); i++) { + for (int i = 0; i < globaldata->Groups.size(); i++) { SharedRAbundVector* temp = new SharedRAbundVector(sharedorder->getNumBins()); temp->setLabel(sharedorder->getLabel()); - temp->setGroup(globaldata->gGroupmap->namesOfGroups[i]); + temp->setGroup(globaldata->Groups[i]); lookup.push_back(temp); } @@ -114,10 +118,15 @@ try { //randomize the groups random_shuffle(lookup.begin(), lookup.end()); - + + vector subset; //send each group one at a time for (int k = 0; k < lookup.size(); k++) { - rcd->updateSharedData(lookup[0], lookup[k], k+1, numGroupComb); + subset.clear(); //clears out old pair of sharedrabunds + //add in new pair of sharedrabunds + subset.push_back(lookup[0]); subset.push_back(lookup[k]); + + rcd->updateSharedData(subset, k+1, numGroupComb); mergeVectors(lookup[0], lookup[k]); } @@ -125,12 +134,17 @@ try { for(int i=0;ireset(); } + + for (int i = 0; i < lookup.size(); i++) { + delete lookup[i]; + } } for(int i=0;iclose(); } - + + delete rcd; } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the Rarefact class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";