]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedordervector.h
bug fixes
[mothur.git] / sharedordervector.h
index c315c44b5468479a813b25922e54baca48841bac..6aa8ba1c1ed0dc6ef49f1aa5d8becac971852126 100644 (file)
@@ -15,8 +15,6 @@
        the group it is in and the abundance is equal to the OTU number.  */
 
 
-using namespace std;
-
 #include "datavector.hpp"
 
 struct individual {
@@ -26,8 +24,20 @@ struct individual {
                bool operator()(const individual& i1, const individual& i2) {
                return (i1.abundance > i2.abundance);
                }
+       individual() { group = ""; bin = 0; abundance = 0; }
+};
+
+struct individualFloat {
+               string group;
+               int bin;
+               float abundance;
+               bool operator()(const individual& i1, const individual& i2) {
+               return (i1.abundance > i2.abundance);
+               }
+       individualFloat() { group = ""; bin = 0; abundance = 0.0; }
 };
 
+
 #include "sabundvector.hpp"
 #include "rabundvector.hpp"
 #include "sharedrabundvector.h"
@@ -49,15 +59,16 @@ public:
        SharedOrderVector(ifstream&);
        ~SharedOrderVector(){};
        
-       void set(int, int, int, string);        //index, OTU, abundance, group
+       
        individual get(int);
-       void push_back(int, int, string);  //OTU, abundance, group
        void resize(int);
        int size();
        void print(ostream&);
        vector<individual>::iterator begin();
        vector<individual>::iterator end();
-
+       void push_back(int, int, string);  //OTU, abundance, group  MUST CALL UPDATE STATS AFTER PUSHBACK!!!
+       void updateStats();
+       void clear();
 
        int getNumBins();
        int getNumSeqs();
@@ -69,6 +80,7 @@ public:
        SharedOrderVector getSharedOrderVector();
        SharedRAbundVector getSharedRAbundVector(string);  //get the sharedRabundvector for a sepecific group
        SharedSAbundVector getSharedSAbundVector(string);       //get the sharedSabundvector for a sepecific group
+       vector<SharedRAbundVector*> getSharedRAbundVector(); //returns sharedRabundVectors for all the users groups
        
 private:
        GlobalData* globaldata;
@@ -79,7 +91,8 @@ private:
        int numBins;
        int numSeqs;
        bool needToUpdate;
-       void updateStats();
+       void set(int, int, int, string);        //index, OTU, abundance, group
+       
 };
 
 #endif