]> git.donarmstrong.com Git - mothur.git/blob - subsample.h
changing command name classify.shared to classifyrf.shared
[mothur.git] / subsample.h
1 #ifndef Mothur_subsample_h
2 #define Mothur_subsample_h
3
4 //
5 //  subsample.h
6 //  Mothur
7 //
8 //  Created by Sarah Westcott on 4/2/12.
9 //  Copyright (c) 2012 Schloss Lab. All rights reserved.
10 //
11
12 #include "mothurout.h"
13 #include "sharedrabundvector.h"
14 #include "treemap.h"
15 #include "tree.h"
16 #include "counttable.h"
17
18 struct item {
19     string name;
20     string group;
21     
22     item() {}
23     item(string n, string g) : name(n), group(g) {}
24     ~item() {}
25 };
26
27 //subsampling overwrites the sharedRabunds.  If you need to reuse the original use the getSamplePreserve function.
28
29 class SubSample {
30         
31     public:
32     
33         SubSample() { m = MothurOut::getInstance(); }
34         ~SubSample() {}
35     
36         vector<string> getSample(vector<SharedRAbundVector*>&, int); //returns the bin labels for the subsample, mothurOuts binlabels are preserved so you can run this multiple times. Overwrites original vector passed in, if you need to preserve it deep copy first.
37         Tree* getSample(Tree*, CountTable*, CountTable*, int); //creates new subsampled tree. Uses first counttable to fill new counttable with sabsampled seqs. Sets groups of seqs not in subsample to "doNotIncludeMe".
38         int getSample(SAbundVector*&, int); //destroys sabundvector passed in, so copy it if you need it
39         CountTable getSample(CountTable&, int, vector<string>); //subsample a countTable bygroup(same number sampled from each group, returns subsampled countTable 
40         CountTable getSample(CountTable&, int, vector<string>, bool); //subsample a countTable. If you want to only sample from specific groups, pass in groups in the vector and set bool=true, otherwise set bool=false.   
41     
42     private:
43     
44         MothurOut* m;
45         int eliminateZeroOTUS(vector<SharedRAbundVector*>&);
46          map<string, string> deconvolute(map<string, string> wholeSet, vector<string>& subsampleWanted); //returns new nameMap containing only subsampled names, and removes redundants from subsampled wanted because it makes the new nameMap.
47
48
49 };
50
51 #endif