X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sharedrabundvector.cpp;h=51e277a659ce33789482ea837db6c7a6d0075b25;hb=c47e480b743d1c242b8c527b6d12f992c68b8c2c;hp=7952859bccb3048bd796bdb05f74d2d920ed9c05;hpb=8742edef7a51b82834289e570d336f5a81ba1f2b;p=mothur.git diff --git a/sharedrabundvector.cpp b/sharedrabundvector.cpp index 7952859..51e277a 100644 --- a/sharedrabundvector.cpp +++ b/sharedrabundvector.cpp @@ -59,8 +59,9 @@ SharedRAbundVector::SharedRAbundVector(string id, vector rav) : Data //reads a shared file SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), numBins(0), numSeqs(0) { try { - m->namesOfGroups.clear(); - + m->clearAllGroups(); + vector allGroups; + int num, inputData, count; count = 0; string holdLabel, nextLabel, groupN; @@ -112,7 +113,7 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), lookup[0]->setLabel(label); lookup[0]->setGroup(groupN); - m->namesOfGroups.push_back(groupN); + allGroups.push_back(groupN); //fill vector. data = first sharedrabund in file for(int i=0;i> groupN >> num; count++; - m->namesOfGroups.push_back(groupN); + allGroups.push_back(groupN); //add new vector to lookup temp = new SharedRAbundVector(); @@ -152,7 +153,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0), if (f.eof() != true) { f >> nextLabel; } } - m->saveNextLabel = nextLabel; + m->saveNextLabel = nextLabel; + m->setAllGroups(allGroups); } catch(exception& e) { @@ -393,7 +395,7 @@ int SharedRAbundVector::getGroupIndex() { return index; } void SharedRAbundVector::setGroupIndex(int vIndex) { index = vIndex; } /***********************************************************************/ int SharedRAbundVector::getNumBins(){ - return numBins; + return numBins; } /***********************************************************************/ @@ -418,12 +420,15 @@ vector SharedRAbundVector::getSharedRAbundVectors(){ SharedUtil* util; util = new SharedUtil(); - util->setGroups(m->Groups, m->namesOfGroups); + vector Groups = m->getGroups(); + vector allGroups = m->getAllGroups(); + util->setGroups(Groups, allGroups); + m->setGroups(Groups); bool remove = false; for (int i = 0; i < lookup.size(); i++) { //if this sharedrabund is not from a group the user wants then delete it. - if (util->isValidGroup(lookup[i]->getGroup(), m->Groups) == false) { + if (util->isValidGroup(lookup[i]->getGroup(), m->getGroups()) == false) { remove = true; delete lookup[i]; lookup[i] = NULL; lookup.erase(lookup.begin()+i);