]> git.donarmstrong.com Git - mothur.git/blob - sharedrabundvector.h
fixed metastats, added resize to cluster.classic, added code to kill children if...
[mothur.git] / sharedrabundvector.h
1 #ifndef SHAREDRABUNDVECTOR_H
2 #define SHAREDRABUNDVECTOR_H
3
4 /*
5  *  sharedrabundvector.h
6  *  Dotur
7  *
8  *  Created by Sarah Westcott on 12/5/08.
9  *  Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13 #include "datavector.hpp"
14 #include "sharedordervector.h"
15 #include "sharedsabundvector.h"
16 #include "rabundvector.hpp"
17 #include "groupmap.h"
18
19 /* This class is a child to datavector.  It represents OTU information at a certain distance. 
20         It is similiar to an rabundvector except each member of data knows which group it belongs to.
21         Each member of the internal container "data" is a struct of type individual. 
22         An individual which knows the OTU from which it came, 
23         the group it is in and its abundance.  */
24
25 class GlobalData;
26
27 class SharedRAbundVector : public DataVector {
28         
29 public:
30         SharedRAbundVector();
31         SharedRAbundVector(int);
32         //SharedRAbundVector(string, vector<int>);
33         SharedRAbundVector(const SharedRAbundVector& bv) : DataVector(bv), data(bv.data), maxRank(bv.maxRank), numBins(bv.numBins), numSeqs(bv.numSeqs), group(bv.group), index(bv.index){};
34     SharedRAbundVector(ifstream&);
35         ~SharedRAbundVector();
36
37         int getNumBins();               
38         int getNumSeqs();                                                       
39         int getMaxRank();
40         string getGroup();
41         void setGroup(string);
42         int getGroupIndex();
43         void setGroupIndex(int);                                                                
44
45         void set(int, int, string);                     //OTU, abundance, groupname
46         void setData(vector <individual>);
47         individual get(int);
48         vector <individual> getData();
49         int getAbundance(int);
50         int numNZ();
51         void sortD();  //Sorts the data in descending order.
52         void push_front(int, int, string); //abundance, otu, groupname
53         void insert(int, int, string); //abundance, otu, groupname
54         void push_back(int, string);  //abundance, groupname
55         void pop_back();
56         void resize(int);
57         int size();
58         void clear();
59         vector<individual>::reverse_iterator rbegin();
60         vector<individual>::reverse_iterator rend();
61         
62         void print(ostream&);
63                 
64         RAbundVector getRAbundVector();
65         RAbundVector getRAbundVector2();
66         SAbundVector getSAbundVector();
67         OrderVector getOrderVector(map<string,int>*);
68         SharedOrderVector getSharedOrderVector();
69         SharedSAbundVector getSharedSAbundVector();
70         SharedRAbundVector getSharedRAbundVector();
71         vector<SharedRAbundVector*> getSharedRAbundVectors();
72         
73 private:
74         vector<individual>  data; 
75         vector<SharedRAbundVector*> lookup;
76         GlobalData* globaldata;
77         GroupMap* groupmap;
78         int maxRank;
79         int numBins;
80         int numSeqs;
81         string group;
82         int index;      
83 };
84
85
86 #endif
87