]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedrabundvector.cpp
fixing minor bugs
[mothur.git] / sharedrabundvector.cpp
index 1b8023d8ea190bcde9b64dae1ca815fea84c8136..f60562a75a5202a366a6bf9cbd831421133feab0 100644 (file)
@@ -7,9 +7,6 @@
  *
  */
 
-
-using namespace std;
-
 #include "sharedrabundvector.h" 
 #include "sabundvector.hpp"
 #include "ordervector.hpp"
@@ -18,11 +15,12 @@ using namespace std;
 
 /***********************************************************************/
 
-SharedRAbundVector::SharedRAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0) {};
+SharedRAbundVector::SharedRAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0) {globaldata = GlobalData::getInstance();}
 
 /***********************************************************************/
 
 SharedRAbundVector::SharedRAbundVector(int n) : DataVector(), maxRank(0), numBins(n), numSeqs(0) {
+               globaldata = GlobalData::getInstance();
                individual newGuy;
                //initialize data
                for (int i=0; i< n; i++) {
@@ -30,7 +28,7 @@ SharedRAbundVector::SharedRAbundVector(int n) : DataVector(), maxRank(0), numBin
                        newGuy.abundance = 0;
                        data.push_back(newGuy);
                }
-};
+}
 
 /***********************************************************************
 
@@ -78,7 +76,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                holdLabel = label;
                
                //add new vector to lookup
-               lookup.push_back(new SharedRAbundVector(num));
+               SharedRAbundVector* temp = new SharedRAbundVector();
+               lookup.push_back(temp);
                lookup[0]->setLabel(label);
                lookup[0]->setGroup(groupN);
                
@@ -117,7 +116,8 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                        }
                        
                        //add new vector to lookup
-                       lookup.push_back(new SharedRAbundVector(num));
+                       temp = new SharedRAbundVector();
+                       lookup.push_back(temp);
                        lookup[count]->setLabel(label);
                        lookup[count]->setGroup(groupN);
 
@@ -136,7 +136,7 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
                //put file pointer back since you are now at a new distance label
                f.seekg(pos, ios::beg);
        
-               if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap; }
+               if (globaldata->gGroupmap == NULL) { globaldata->gGroupmap = groupmap;  }
                
        }
        catch(exception& e) {
@@ -151,12 +151,6 @@ SharedRAbundVector::SharedRAbundVector(ifstream& f) : DataVector(), maxRank(0),
 
 /***********************************************************************/
 
-SharedRAbundVector::~SharedRAbundVector() {
-
-}
-
-/***********************************************************************/
-
 void SharedRAbundVector::set(int binNumber, int newBinSize, string groupname){
        try {
                int oldBinSize = data[binNumber].abundance;
@@ -514,6 +508,8 @@ SharedOrderVector SharedRAbundVector::getSharedOrderVector() {
                random_shuffle(ov.begin(), ov.end());
 
                ov.setLabel(label);     
+               ov.updateStats();
+               
                return ov;
        }
        catch(exception& e) {