]> git.donarmstrong.com Git - mothur.git/blob - sharedlistvector.h
Revert to previous commit
[mothur.git] / sharedlistvector.h
1 #ifndef SHAREDLIST_H
2 #define SHAREDLIST_H
3
4 /*
5  *  sharedlistvector.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 1/22/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13 #include "datavector.hpp"
14 #include "groupmap.h"
15 #include "sharedrabundvector.h"
16 #include "sharedsabundvector.h"
17
18 /* This class is a child to datavector.  It represents OTU information at a certain distance. 
19         A sharedlistvector can be converted into a sharedordervector, sharedrabundvector or sharedsabundvectorand 
20         as well as an ordervector, rabundvector or sabundvector.
21         Each member of the internal container "data" represents an individual OTU.
22         Each individual in the OTU belongs to a group.
23         So data[0] = "a,b,c,d,e,f".
24         example: listvector             =       a,b,c,d,e,f             g,h,i           j,k             l               m  
25                          rabundvector   =       6                               3                       2               1               1
26                          sabundvector   =       2               1               1               0               0               1
27                          ordervector    =       1       1       1       1       1       1       2       2       2       3       3       4       5 */
28
29 class SharedListVector : public DataVector {
30         
31 public:
32         SharedListVector();
33         SharedListVector(int);
34         SharedListVector(ifstream&);
35         SharedListVector(const SharedListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs){ groupmap = NULL; };
36         ~SharedListVector(){ if (groupmap != NULL) { delete groupmap; } };
37         
38         int getNumBins()                                                        {       return numBins;         }
39         int getNumSeqs()                                                        {       return numSeqs;         }
40         int getMaxRank()                                                        {       return maxRank;         }
41
42         void set(int, string);  
43         string get(int);
44         void push_back(string);
45         void resize(int);
46         void clear();
47         int size();
48         void print(ostream&);
49         
50         RAbundVector getRAbundVector();
51         SAbundVector getSAbundVector();
52         OrderVector getOrderVector(map<string,int>*);
53         SharedOrderVector* getSharedOrderVector();
54         SharedRAbundVector getSharedRAbundVector(string);  //get sharedrabundvector for a certain group
55         SharedSAbundVector getSharedSAbundVector(string);                       //get sharedsabundvector for a certain group
56         vector<SharedRAbundVector*> getSharedRAbundVector(); //returns sharedRabundVectors for all the users groups
57         
58 private:
59         vector<string> data;  //data[i] is a list of names of sequences in the ith OTU.
60         GroupMap* groupmap;
61         int maxRank;
62         int numBins;
63         int numSeqs;
64
65 };
66
67 #endif