]> git.donarmstrong.com Git - mothur.git/blob - concensuscommand.h
fixed concensus command and modified tree class so you can print labels on trees
[mothur.git] / concensuscommand.h
1 #ifndef CONCENSUSCOMMAND_H
2 #define CONCENSUSCOMMAND_H
3 /*
4  *  concensuscommand.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 #include "command.hpp"
13 #include "tree.h"
14 #include "treemap.h"
15 #include "sharedutilities.h"
16         
17 class GlobalData;
18
19 class ConcensusCommand : public Command {
20         
21 public:
22         ConcensusCommand();     
23         ~ConcensusCommand();
24         int execute();  
25         
26 private:
27         GlobalData* globaldata;
28         SharedUtil* util;
29         vector<Tree*> t;
30         Tree* concensusTree;
31         vector<string> treeSet;         //set containing all members of the tree to start recursion.  filled in getSets().
32         map< vector<string>, int > nodePairs;  //<map of possible combinations these combos are the pcounts or descendants info, to how many times they occured
33                                                                                 // ie. combos FI and EGK would create nodePairs[vector containing F and I] = 1; nodePairs[vector containing E, G and K] = 1
34                                                                                 // if you saw the combo FI again in another tree you would then update nodePairs[vector containing F and I] = 2;
35                                                                                 // requires vectors to be sorted to find key.
36         map< vector<string>, int > nodePairsInTree;
37         map<string, int>::iterator it;
38         map< vector<string>, int>::iterator it2;
39         string outputFile, notIncluded;
40         ofstream out, out2;
41         int numNodes, numLeaves, count;  //count is the next available spot in the tree vector
42                                                                                 
43         void getSets();
44         vector<string> getNextAvailableSet(vector<string>);  //gets next largest and highest rated set that is a subset of the set passed in.
45         vector<string> getRestSet(vector<string>, vector<string>);
46         bool isSubset(vector<string>, vector<string>); 
47         int findSpot(string); 
48         int buildConcensusTree(vector<string>);
49         
50 };
51
52 #endif
53