]> git.donarmstrong.com Git - mothur.git/blob - sabundvector.hpp
3c68462a425b5f1710f679c4272c4b5e6e6c7877
[mothur.git] / sabundvector.hpp
1 #ifndef SABUND_H
2 #define SABUND_H
3
4 using namespace std;
5
6 #include "datavector.hpp"
7 #include "rabundvector.hpp"
8 #include "ordervector.hpp"
9
10
11 /* This class is a child to datavector.  It represents OTU information at a certain distance. 
12         A sabundvector can be converted into and ordervector, listvector or rabundvector.
13         Each member of the internal container "data" represents the number of OTU's with that many members, but staring at 1.
14         So data[1] = 2, because there are two OTUs with 1 member.
15         example: listvector             =       a,b,c,d,e,f             g,h,i           j,k             l               m  
16                          rabundvector   =       6                               3                       2               1               1
17                          sabundvector   =       2               1               1               0               0               1
18                          ordervector    =       1       1       1       1       1       1       2       2       2       3       3       4       5 */
19
20
21 class SAbundVector : public DataVector {
22         
23 public:
24         SAbundVector();
25         SAbundVector(int);
26 //      SAbundVector(const SAbundVector&);
27         SAbundVector(string, vector<int>);
28         SAbundVector(const SAbundVector& rv) : DataVector(rv.label), data(rv.data), maxRank(rv.maxRank), numBins(rv.numBins), numSeqs(rv.numSeqs){};
29         SAbundVector(ifstream&);
30         ~SAbundVector(){};
31
32         int getNumBins();       
33         int getNumSeqs();       
34         int getMaxRank();       
35         
36         void set(int, int);
37         int get(int);
38         void push_back(int);
39         void resize(int);
40         int size();
41
42         void print(ostream&);
43         void print(string, ostream&);
44                 
45         RAbundVector getRAbundVector(); 
46         SAbundVector getSAbundVector();
47         OrderVector getOrderVector(map<string,int>*);
48         
49 private:
50         vector<int> data;
51 //      bool needToUpdate;
52 //      void updateStats();
53         int maxRank;
54         int numBins;
55         int numSeqs;
56
57 };
58
59 #endif