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