]> git.donarmstrong.com Git - mothur.git/blob - listvector.hpp
adding labels to list file.
[mothur.git] / listvector.hpp
1 #ifndef LIST_H
2 #define LIST_H
3
4 #include "datavector.hpp"
5
6 /*      DataStructure for a list file.
7         This class is a child to datavector.  It represents OTU information at a certain distance. 
8         A list vector can be converted into and ordervector, rabundvector or sabundvector.
9         Each member of the internal container "data" represents an individual OTU.
10         So data[0] = "a,b,c,d,e,f".
11         example: listvector             =       a,b,c,d,e,f             g,h,i           j,k             l               m  
12                          rabundvector   =       6                               3                       2               1               1
13                          sabundvector   =       2               1               1               0               0               1
14                          ordervector    =       1       1       1       1       1       1       2       2       2       3       3       4       5 */
15
16 class ListVector : public DataVector {
17         
18 public:
19         ListVector();
20         ListVector(int);
21 //      ListVector(const ListVector&);
22         ListVector(string, vector<string>);
23         ListVector(const ListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs), binLabels(lv.binLabels) {};
24         ListVector(ifstream&);
25         ~ListVector(){};
26         
27         int getNumBins()                                                        {       return numBins;         }
28         int getNumSeqs()                                                        {       return numSeqs;         }
29         int getMaxRank()                                                        {       return maxRank;         }
30
31         void set(int, string);  
32         string get(int);
33     vector<string> getLabels();
34     void setLabels(vector<string>);
35         void push_back(string);
36         void resize(int);
37         void clear();
38         int size();
39         void print(ostream&);
40     void printHeaders(ostream&);
41         
42         RAbundVector getRAbundVector();
43         SAbundVector getSAbundVector();
44         OrderVector getOrderVector(map<string,int>*);
45         
46 private:
47         vector<string> data;  //data[i] is a list of names of sequences in the ith OTU.
48         int maxRank;
49         int numBins;
50         int numSeqs;
51     vector<string> binLabels;
52
53 };
54
55 #endif