]> git.donarmstrong.com Git - mothur.git/blob - sharedlistvector.h
finishing the container classes, combining read.otu and read.list commands. some...
[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 <Carbon/Carbon.h>
14 #include "datavector.hpp"
15 #include "groupmap.h"
16 #include "globaldata.hpp"
17 #include "sharedrabundvector.h"
18 #include "sharedsabundvector.h"
19 #include <iostream>
20 #include <map>
21
22 /* This class is a child to datavector.  It represents OTU information at a certain distance. 
23         A sharedlistvector can be converted into a sharedordervector, sharedrabundvector or sharedsabundvectorand 
24         as well as an ordervector, rabundvector or sabundvector.
25         Each member of the internal container "data" represents an individual OTU.
26         Each individual in the OTU belongs to a group.
27         So data[0] = "a,b,c,d,e,f".
28         example: listvector             =       a,b,c,d,e,f             g,h,i           j,k             l               m  
29                          rabundvector   =       6                               3                       2               1               1
30                          sabundvector   =       2               1               1               0               0               1
31                          ordervector    =       1       1       1       1       1       1       2       2       2       3       3       4       5 */
32
33 class SharedListVector : public DataVector {
34         
35 public:
36         SharedListVector(int);
37         SharedListVector(ifstream&);
38         SharedListVector(const SharedListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs){};
39         ~SharedListVector(){};
40         
41         int getNumBins()                                                        {       return numBins;         }
42         int getNumSeqs()                                                        {       return numSeqs;         }
43         int getMaxRank()                                                        {       return maxRank;         }
44
45         void set(int, string);  
46         string get(int);
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         
60 private:
61         vector<string> data;  //data[i] is a list of names of sequences in the ith OTU.
62         GlobalData* globaldata;
63         GroupMap* groupmap;
64         int maxRank;
65         int numBins;
66         int numSeqs;
67
68 };
69
70 #endif
71