]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedlistvector.cpp
fixing minor bugs
[mothur.git] / sharedlistvector.cpp
index b5624508ac792aa82d367ed04ed1fbaf571d4cd6..4774180dd6032c0de1b87597360af6d14e7c2a2d 100644 (file)
@@ -7,10 +7,6 @@
  *
  */
 
-
-using namespace std;
-
-
 #include "sabundvector.hpp"
 #include "rabundvector.hpp"
 #include "ordervector.hpp"
@@ -20,11 +16,11 @@ using namespace std;
 
 /***********************************************************************/
 
-SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){};
+SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance();}
 
 /***********************************************************************/
 
-SharedListVector::SharedListVector(int n):     DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){};
+SharedListVector::SharedListVector(int n):     DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance();}
 
 /***********************************************************************/
 SharedListVector::SharedListVector(ifstream& f) : DataVector(), maxRank(0), numBins(0), numSeqs(0) {
@@ -234,7 +230,10 @@ SharedOrderVector* SharedListVector::getSharedOrderVector(){
                        groupName = groupmap->getGroup(names);
                        order->push_back(i, binSize, groupName);
                }
+
                random_shuffle(order->begin(), order->end());
+               order->updateStats();
+               
                return order;
        }
        catch(exception& e) {
@@ -273,6 +272,7 @@ SharedRAbundVector SharedListVector::getSharedRAbundVector(string groupName) {
                
                rav.setLabel(label);
                rav.setGroup(groupName);
+
                return rav;
                
        }
@@ -293,8 +293,15 @@ vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
                vector<SharedRAbundVector*> lookup;
                
                util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups);
-               util->getSharedVectors(globaldata->Groups, lookup, this->getSharedOrderVector());
                
+               delete util;
+
+               for (int i = 0; i < globaldata->Groups.size(); i++) {
+                       SharedRAbundVector* temp = new SharedRAbundVector();
+                       *temp = getSharedRAbundVector(globaldata->Groups[i]);
+                       lookup.push_back(temp);
+               }
+
                return lookup;
        }
        catch(exception& e) {