]> git.donarmstrong.com Git - mothur.git/blob - sharedrabundvector.h
Revert to previous commit
[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 "sharedrabundfloatvector.h"
17 #include "rabundvector.hpp"
18 //#include "groupmap.h"
19
20 /*  DataStructure for a shared file.
21         This class is a child to datavector.  It represents OTU information at a certain distance. 
22         It is similiar to an rabundvector except each member of data knows which group it belongs to.
23         Each member of the internal container "data" is a struct of type individual. 
24         An individual which knows the OTU from which it came, 
25         the group it is in and its abundance.  */
26
27 //class GlobalData;
28
29 class SharedRAbundVector : public DataVector {
30         
31 public:
32         SharedRAbundVector();
33         SharedRAbundVector(int);
34         //SharedRAbundVector(string, vector<int>);
35         SharedRAbundVector(const SharedRAbundVector& bv) : DataVector(bv), data(bv.data), maxRank(bv.maxRank), numBins(bv.numBins), numSeqs(bv.numSeqs), group(bv.group), index(bv.index){};
36     SharedRAbundVector(ifstream&);
37         ~SharedRAbundVector();
38
39         int getNumBins();               
40         int getNumSeqs();                                                       
41         int getMaxRank();
42         string getGroup();
43         void setGroup(string);
44         string getBinLabel();
45         void setBinLabel(string);
46         int getGroupIndex();
47         void setGroupIndex(int);                                                                
48
49         void set(int, int, string);                     //OTU, abundance, groupname
50         void setData(vector <individual>);
51         individual get(int);
52         vector <individual> getData();
53         int getAbundance(int);
54         int numNZ();
55         void sortD();  //Sorts the data in descending order.
56         void push_front(int, int, string); //abundance, otu, groupname
57         void insert(int, int, string); //abundance, otu, groupname
58         void push_back(int, string);  //abundance, groupname
59         void pop_back();
60         void resize(int);
61         int size();
62         void clear();
63         vector<individual>::reverse_iterator rbegin();
64         vector<individual>::reverse_iterator rend();
65         
66         void print(ostream&);
67         void printHeaders(ostream&);
68                 
69         RAbundVector getRAbundVector();
70         RAbundVector getRAbundVector2();
71         SAbundVector getSAbundVector();
72         OrderVector getOrderVector(map<string,int>*);
73         SharedOrderVector getSharedOrderVector();
74         SharedSAbundVector getSharedSAbundVector();
75         SharedRAbundVector getSharedRAbundVector();
76         vector<SharedRAbundVector*> getSharedRAbundVectors();
77         vector<SharedRAbundFloatVector*> getSharedRAbundFloatVectors(vector<SharedRAbundVector*>);
78         
79 private:
80         vector<individual>  data; 
81         vector<SharedRAbundVector*> lookup;
82         //GlobalData* globaldata;
83         //GroupMap* groupmap;
84         int maxRank;
85         int numBins;
86         int numSeqs;
87         string group;
88         int index;      
89         
90         int eliminateZeroOTUS(vector<SharedRAbundVector*>&);
91 };
92
93
94 #endif
95