]> git.donarmstrong.com Git - mothur.git/blob - phylosummary.h
9ebdf81ac4fbd06490f05d7be7c15b6f6a5d1179
[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
17 /**************************************************************************************************/
18
19 struct rawTaxNode {
20         map<string, int> children;  //childs name to index in tree
21         int parent, level;
22         string name, rank;
23         map<string, int> groupCount;
24         int total;
25         
26         rawTaxNode(string n) : name(n), level(0), parent(-1), total(0) {}
27         rawTaxNode(){}
28 };
29
30 /**************************************************************************************************/
31 //doesn't use MPI ifdefs since only pid 0 uses this class
32 class PhyloSummary {
33
34 public:
35         PhyloSummary(string, string);
36         ~PhyloSummary() { if (groupmap != NULL)  {  delete groupmap;  }  }
37         
38         void summarize(string);  //pass it a taxonomy file and a group file and it makes the tree
39         int addSeqToTree(string, string);
40         void print(ofstream&);
41         int getMaxLevel() { return maxLevel; }
42         
43 private:
44         string getNextTaxon(string&);
45         vector<rawTaxNode> tree;
46         void print(int, ofstream&);
47         void assignRank(int);
48         void readTreeStruct(ifstream&);
49         GroupMap* groupmap;
50         
51         int numNodes;
52         int numSeqs;
53         int maxLevel;
54         MothurOut* m;
55 };
56
57 /**************************************************************************************************/
58
59 #endif
60
61