]> git.donarmstrong.com Git - mothur.git/blobdiff - phylosummary.h
Revert to previous commit
[mothur.git] / phylosummary.h
diff --git a/phylosummary.h b/phylosummary.h
new file mode 100644 (file)
index 0000000..cdec0d0
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef RAWTRAININGDATAMAKER_H
+#define RAWTRAININGDATAMAKER_H
+
+/*
+ *  rawTrainingDataMaker.h
+ *  Mothur
+ *
+ *  Created by westcott on 4/21/10.
+ *  Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "mothur.h"
+#include "mothurout.h"
+#include "groupmap.h"
+
+/**************************************************************************************************/
+
+struct rawTaxNode {
+       map<string, int> children;  //childs name to index in tree
+       int parent, level;
+       string name, rank;
+       map<string, int> groupCount;
+       int total;
+       
+       rawTaxNode(string n) : name(n), level(0), parent(-1), total(0) {}
+       rawTaxNode(){}
+};
+
+/**************************************************************************************************/
+//doesn't use MPI ifdefs since only pid 0 uses this class
+class PhyloSummary {
+
+public:
+       PhyloSummary(string);
+       PhyloSummary(string, string);
+       ~PhyloSummary() { if (groupmap != NULL)  {  delete groupmap;  }  }
+       
+       int summarize(string);  //pass it a taxonomy file and a group file and it makes the tree
+       int addSeqToTree(string, string);
+       int addSeqToTree(string, vector<string>);
+       void print(ofstream&);
+       int getMaxLevel() { return maxLevel; }
+       
+private:
+       string getNextTaxon(string&);
+       vector<rawTaxNode> tree;
+       void print(int, ofstream&);
+       void assignRank(int);
+       void readTreeStruct(ifstream&);
+       GroupMap* groupmap;
+       bool ignore;
+       
+       int numNodes;
+       int numSeqs;
+       int maxLevel;
+       MothurOut* m;
+};
+
+/**************************************************************************************************/
+
+#endif
+
+