]> git.donarmstrong.com Git - mothur.git/blob - sharedordervector.h
b1b4a653dd51fb0280a5ea1189d690cf090614a4
[mothur.git] / sharedordervector.h
1 #ifndef SHAREDORDER_H
2 #define SHAREDORDER_H
3 /*
4  *  sharedorder.h
5  *  Dotur
6  *
7  *  Created by Sarah Westcott on 12/9/08.
8  *  Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11  
12  /* This class is a child to datavector.  It represents OTU information at a certain distance. 
13         It is similiar to an order vector except each member of data knows which group it belongs to.
14         Each member of the internal container "data" represents is an individual which knows the OTU from which it came, 
15         the group it is in and the abundance is equal to the OTU number.  */
16
17
18 using namespace std;
19
20 #include "datavector.hpp"
21
22 struct individual {
23                 string group;
24                 int bin;
25                 int abundance;
26 };
27
28 #include "sabundvector.hpp"
29 #include "rabundvector.hpp"
30 #include "sharedrabundvector.h"
31 #include "sharedsabundvector.h"
32
33 class SharedOrderVector : public DataVector {
34         
35 public:
36         SharedOrderVector();
37 //      SharedOrderVector(int ns, int nb=0, int mr=0)   : DataVector(), data(ns, -1), maxRank(0), numBins(0), numSeqs(0) {};
38         SharedOrderVector(const SharedOrderVector& ov)  : DataVector(ov.label), data(ov.data), maxRank(ov.maxRank), numBins(ov.numBins), numSeqs(ov.numSeqs), needToUpdate(ov.needToUpdate) {if(needToUpdate == 1){     updateStats();}};
39
40         SharedOrderVector(string, vector<individual>);
41 //      SharedOrderVector(ifstream&);
42         ~SharedOrderVector(){};
43         
44         void set(int, int, int, string);        //index, OTU, abundance, group
45         individual get(int);
46         void push_back(int, int, string);  //OTU, abundance, group
47         void resize(int);
48         int size();
49         void print(ostream&);
50         vector<individual>::iterator begin();
51         vector<individual>::iterator end();
52
53
54         int getNumBins();
55         int getNumSeqs();
56         int getMaxRank();
57                 
58         RAbundVector getRAbundVector();
59         SAbundVector getSAbundVector();
60         OrderVector getOrderVector(map<string,int>*);
61         SharedOrderVector getSharedOrderVector();
62         SharedRAbundVector getSharedRAbundVector(string);  //get the sharedRabundvector for a sepecific group
63         SharedSAbundVector getSharedSAbundVector(string);       //get the sharedSabundvector for a sepecific group
64         
65 private:
66         vector<individual>  data; 
67         map< int, vector<individual> >::iterator it;
68         int maxRank;
69         int numBins;
70         int numSeqs;
71         bool needToUpdate;
72         void updateStats();
73 };
74
75 #endif
76