X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=subsample.cpp;fp=subsample.cpp;h=e6dd845adf9b64bec6c932f4cf72de6d8b9fe909;hb=e41b86a600fe30f5df9507d7e55027e7b8bd7dd6;hp=d5b4e3ecf19f2114855426350e1ecfbe57780736;hpb=53171f07cc0c0e560e2b4ba2946f690d59fc2dc4;p=mothur.git diff --git a/subsample.cpp b/subsample.cpp index d5b4e3e..e6dd845 100644 --- a/subsample.cpp +++ b/subsample.cpp @@ -8,66 +8,6 @@ #include "subsample.h" -//********************************************************************************************************************** -vector SubSample::getSamplePreserve(vector& thislookup, vector& newLabels, int size) { - try { - - vector newlookup; newlookup.resize(thislookup.size(), NULL); - - //save mothurOut's binLabels to restore for next label - vector saveBinLabels = m->currentBinLabels; - - int numBins = thislookup[0]->getNumBins(); - for (int i = 0; i < thislookup.size(); i++) { - int thisSize = thislookup[i]->getNumSeqs(); - - if (thisSize != size) { - - string thisgroup = thislookup[i]->getGroup(); - - OrderVector order; - for(int p=0;pgetAbundance(p);j++){ - order.push_back(p); - } - } - random_shuffle(order.begin(), order.end()); - - SharedRAbundVector* temp = new SharedRAbundVector(numBins); - temp->setLabel(thislookup[i]->getLabel()); - temp->setGroup(thislookup[i]->getGroup()); - - newlookup[i] = temp; - - for (int j = 0; j < size; j++) { - - if (m->control_pressed) { return newlookup; } - - int bin = order.get(j); - - int abund = newlookup[i]->getAbundance(bin); - newlookup[i]->set(bin, (abund+1), thisgroup); - } - } - } - - //subsampling may have created some otus with no sequences in them - eliminateZeroOTUS(newlookup); - - if (m->control_pressed) { return newlookup; } - - //save mothurOut's binLabels to restore for next label - newLabels = m->currentBinLabels; - m->currentBinLabels = saveBinLabels; - - return newlookup; - - } - catch(exception& e) { - m->errorOut(e, "SubSample", "getSamplePreserve"); - exit(1); - } -} //********************************************************************************************************************** vector SubSample::getSample(vector& thislookup, int size) { try {