X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sharedlistvector.cpp;fp=sharedlistvector.cpp;h=3cb3e9e57c4da06f0589272cff4b3e97bd92eea4;hb=301b61cb98aaa4641f8701f43cf830c0fa44fac1;hp=4774180dd6032c0de1b87597360af6d14e7c2a2d;hpb=163b300cfd7d4ca4e70c454be20f07b1d8346650;p=mothur.git diff --git a/sharedlistvector.cpp b/sharedlistvector.cpp index 4774180..3cb3e9e 100644 --- a/sharedlistvector.cpp +++ b/sharedlistvector.cpp @@ -16,11 +16,11 @@ /***********************************************************************/ -SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance();} +SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance(); groupmap = NULL; } /***********************************************************************/ -SharedListVector::SharedListVector(int n): DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance();} +SharedListVector::SharedListVector(int n): DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance(); groupmap = NULL; } /***********************************************************************/ SharedListVector::SharedListVector(ifstream& f) : DataVector(), maxRank(0), numBins(0), numSeqs(0) { @@ -291,17 +291,38 @@ vector SharedListVector::getSharedRAbundVector() { SharedUtil* util; util = new SharedUtil(); vector lookup; + map finder; + string group, names, name; util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups); delete util; for (int i = 0; i < globaldata->Groups.size(); i++) { - SharedRAbundVector* temp = new SharedRAbundVector(); - *temp = getSharedRAbundVector(globaldata->Groups[i]); - lookup.push_back(temp); + SharedRAbundVector* temp = new SharedRAbundVector(data.size()); + finder[globaldata->Groups[i]] = temp; + finder[globaldata->Groups[i]]->setLabel(label); + finder[globaldata->Groups[i]]->setGroup(globaldata->Groups[i]); + //*temp = getSharedRAbundVector(globaldata->Groups[i]); + lookup.push_back(finder[globaldata->Groups[i]]); } - + + //fill vectors + for(int i=0;igetGroup(name); + finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in + } + + //get last name + group = groupmap->getGroup(names); + finder[group]->set(i, finder[group]->getAbundance(i) + 1, group); //i represents what bin you are in + + } + return lookup; } catch(exception& e) {