]> git.donarmstrong.com Git - mothur.git/blob - sabundvector.hpp
changing command name classify.shared to classifyrf.shared
[mothur.git] / sabundvector.hpp
1 #ifndef SABUND_H
2 #define SABUND_H
3
4 #include "datavector.hpp"
5 #include "rabundvector.hpp"
6 #include "ordervector.hpp"
7 #include "calculator.h"
8
9
10 /*  Data Structure for a sabund file.
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(vector<int>, int, int, int);
28         SAbundVector(string, vector<int>);
29         SAbundVector(const SAbundVector& rv) : DataVector(rv.label), data(rv.data), maxRank(rv.maxRank), numBins(rv.numBins), numSeqs(rv.numSeqs){};
30         SAbundVector(ifstream&);
31         ~SAbundVector(){};
32
33         int getNumBins();       
34         int getNumSeqs();       
35         int getMaxRank();       
36         
37         void set(int, int);
38         int get(int);
39         void push_back(int);
40         void quicksort();
41         int sum();
42         void resize(int);
43         int size();
44         void clear();
45
46         void print(ostream&);
47         void print(string, ostream&);
48                 
49         RAbundVector getRAbundVector();         
50         SAbundVector getSAbundVector();
51         OrderVector getOrderVector(map<string,int>*);
52         
53 private:
54         vector<int> data;
55 //      bool needToUpdate;
56 //      void updateStats();
57         
58         int maxRank;
59         int numBins;
60         int numSeqs;
61
62 };
63
64 #endif