X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=phylosummary.h;fp=phylosummary.h;h=cdec0d0a4ac7ca83cb0845988adb90152bcae07b;hb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;hp=0000000000000000000000000000000000000000;hpb=1b73ff67c83892a025e597dabd9df6fe7b58206a;p=mothur.git diff --git a/phylosummary.h b/phylosummary.h new file mode 100644 index 0000000..cdec0d0 --- /dev/null +++ b/phylosummary.h @@ -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 children; //childs name to index in tree + int parent, level; + string name, rank; + map 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); + void print(ofstream&); + int getMaxLevel() { return maxLevel; } + +private: + string getNextTaxon(string&); + vector tree; + void print(int, ofstream&); + void assignRank(int); + void readTreeStruct(ifstream&); + GroupMap* groupmap; + bool ignore; + + int numNodes; + int numSeqs; + int maxLevel; + MothurOut* m; +}; + +/**************************************************************************************************/ + +#endif + +