]> git.donarmstrong.com Git - mothur.git/blob - consensus.h
changes while testing
[mothur.git] / consensus.h
1 #ifndef CONCENSUS_H
2 #define CONCENSUS_H
3 /*
4  *  consensus.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 4/29/09.
8  *  Copyright 2009 Schloss Lab UMASS AMherst. All rights reserved.
9  *
10  */
11
12
13 #include "tree.h"
14 #include "treemap.h"
15
16 //NOTE: This class assumes all leaf nodes have 1 member.  
17 //      Mothur does allow for names files with trees which would make a tree with multiple members at one leaf.  
18 //      This class is currently only called internally by commands that have leaf node containing only 1 member.
19 //      But if in the future, this changes things will need to be reworked in getSets and buildConsensus.
20
21
22 class Consensus {
23         
24 public:
25         Consensus() { m = MothurOut::getInstance(); }   
26         ~Consensus() {}
27         
28     Tree* getTree(vector<Tree*>&);
29                 
30 private:
31     MothurOut* m;
32     Tree* consensusTree;
33     
34     vector<string> treeSet;             //set containing all members of the tree to start recursion.  filled in getSets().
35         map< vector<string>, int > nodePairs;  //<map of possible combinations these combos are the pcounts or descendants info, to how many times they occured
36                                                                                 // ie. combos FI and EGK would create nodePairs[vector containing F and I] = 1; nodePairs[vector containing E, G and K] = 1
37                                                                                 // if you saw the combo FI again in another tree you would then update nodePairs[vector containing F and I] = 2;
38                                                                                 // requires vectors to be sorted to find key.
39         map< vector<string>, vector< vector<string> > > bestSplit;  //maps a group to its best split
40         map< vector<string>, int > nodePairsInitialRate;
41         map< vector<string>, int > nodePairsInTree;
42         map<string, int>::iterator it;
43         map< vector<string>, int>::iterator it2;
44         string outputFile, notIncluded, filename;
45         int numNodes, numLeaves, count, numTrees;  //count is the next available spot in the tree vector
46         vector<string> outputNames;
47                                                                                 
48         int getSets(vector<Tree*>&);
49         int getSubgroupRating(vector<string>);
50         vector<string> getSmallest(map< vector<string>, int>);
51         vector<string> getNextAvailableSet(vector<string>, vector<string>&);  
52         vector<string> getRestSet(vector<string>, vector<string>);
53         bool isSubset(vector<string>, vector<string>); 
54         int findSpot(string); 
55         int buildConsensusTree(vector<string>);
56     int printSetsInfo();
57         
58 };
59
60 #endif
61