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