]> git.donarmstrong.com Git - mothur.git/blob - phylosummary.h
working on chimera.perseus. made removeConfidences function smarter. Fixed bug in...
[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);
36         PhyloSummary(string, string);
37         ~PhyloSummary() { if (groupmap != NULL)  {  delete groupmap;  }  }
38         
39         int summarize(string);  //pass it a taxonomy file and a group file and it makes the tree
40         int addSeqToTree(string, string);
41         int addSeqToTree(string, vector<string>);
42         void print(ofstream&);
43         int getMaxLevel() { return maxLevel; }
44         
45 private:
46         string getNextTaxon(string&);
47         vector<rawTaxNode> tree;
48         void print(int, ofstream&);
49         void assignRank(int);
50         void readTreeStruct(ifstream&);
51         GroupMap* groupmap;
52         bool ignore;
53         
54         int numNodes;
55         int numSeqs;
56         int maxLevel;
57         MothurOut* m;
58 };
59
60 /**************************************************************************************************/
61
62 #endif
63
64