]> git.donarmstrong.com Git - mothur.git/blob - sharedlistvector.h
fixed bug in sharedcommand and parselistcommand and changed file extension of sorenso...
[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();
37         SharedListVector(int);
38         SharedListVector(ifstream&);
39         SharedListVector(const SharedListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs){};
40         ~SharedListVector(){};
41         
42         int getNumBins()                                                        {       return numBins;         }
43         int getNumSeqs()                                                        {       return numSeqs;         }
44         int getMaxRank()                                                        {       return maxRank;         }
45
46         void set(int, string);  
47         string get(int);
48         void push_back(string);
49         void resize(int);
50         void clear();
51         int size();
52         void print(ostream&);
53         
54         RAbundVector getRAbundVector();
55         SAbundVector getSAbundVector();
56         OrderVector getOrderVector(map<string,int>*);
57         SharedOrderVector* getSharedOrderVector();
58         SharedRAbundVector getSharedRAbundVector(string);  //get sharedrabundvector for a certain group
59         SharedSAbundVector getSharedSAbundVector(string);                       //get sharedsabundvector for a certain group
60         
61 private:
62         vector<string> data;  //data[i] is a list of names of sequences in the ith OTU.
63         GlobalData* globaldata;
64         GroupMap* groupmap;
65         int maxRank;
66         int numBins;
67         int numSeqs;
68
69 };
70
71 #endif
72