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