]> git.donarmstrong.com Git - mothur.git/blob - phylosummary.h
changes while testing
[mothur.git] / phylosummary.h
1 #ifndef RAWTRAININGDATAMAKER_H
2 #define RAWTRAININGDATAMAKER_H
3
4 /*
5  *  rawTrainingDataMaker.h
6  *  Mothur
7  *
8  *  Created by westcott on 4/21/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14 #include "mothurout.h"
15 #include "groupmap.h"
16 #include "counttable.h"
17
18 /**************************************************************************************************/
19
20 struct rawTaxNode {
21         map<string, int> children;  //childs name to index in tree
22         int parent, level;
23         string name, rank;
24         map<string, int> groupCount;
25         int total;
26         
27         rawTaxNode(string n) : name(n), level(0), parent(-1), total(0) {}
28         rawTaxNode(){}
29 };
30
31 /**************************************************************************************************/
32 //doesn't use MPI ifdefs since only pid 0 uses this class
33 class PhyloSummary {
34
35 public:
36         PhyloSummary(GroupMap*);
37         PhyloSummary(string, GroupMap*);
38     PhyloSummary(CountTable*);
39         PhyloSummary(string, CountTable*);
40         ~PhyloSummary() {}
41         
42         int summarize(string);  //pass it a taxonomy file and a group file and it makes the tree
43         int addSeqToTree(string, string);
44         int addSeqToTree(string, map<string, bool>);
45         void print(ofstream&);
46     void print(ofstream&, bool);
47         int getMaxLevel() { return maxLevel; }
48         
49 private:
50         string getNextTaxon(string&);
51         vector<rawTaxNode> tree;
52         void print(int, ofstream&);
53     void print(int, ofstream&, bool);
54         void assignRank(int);
55         void readTreeStruct(ifstream&);
56         GroupMap* groupmap;
57     CountTable* ct;
58         bool ignore;
59         
60         int numNodes;
61         int numSeqs;
62         int maxLevel;
63         MothurOut* m;
64 };
65
66 /**************************************************************************************************/
67
68 #endif
69
70