]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedlistvector.cpp
fixed some bugs found while testing 1.8
[mothur.git] / sharedlistvector.cpp
index a113ebe7e82e93f135541b0bfa0ffc7a3b1d33b1..4303cfde13d3c4250c8f952c7a6eeb4bd9a2553d 100644 (file)
@@ -263,23 +263,23 @@ vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
        try {
                SharedUtil* util;
                util = new SharedUtil();
-               vector<SharedRAbundVector*> lookup;
-               map<string, SharedRAbundVector*> finder;
+               vector<SharedRAbundVector*> lookup;  //contains just the groups the user selected
+               map<string, SharedRAbundVector*> finder;  //contains all groups in groupmap
                string group, names, name;
-               
+       
                util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups);
-               
                delete util;
 
-               for (int i = 0; i < globaldata->Groups.size(); i++) {
+               for (int i = 0; i < globaldata->gGroupmap->namesOfGroups.size(); i++) {
                        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]]);
+                       finder[globaldata->gGroupmap->namesOfGroups[i]] = temp;
+                       finder[globaldata->gGroupmap->namesOfGroups[i]]->setLabel(label);
+                       finder[globaldata->gGroupmap->namesOfGroups[i]]->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
+                       if (inVector(globaldata->gGroupmap->namesOfGroups[i], globaldata->Groups)) {  //if this group is in user groups
+                               lookup.push_back(finder[globaldata->gGroupmap->namesOfGroups[i]]);
+                       }
                }
-               
+       
                //fill vectors
                for(int i=0;i<numBins;i++){
                        names = get(i);