]> git.donarmstrong.com Git - mothur.git/blob - consensuscommand.h
added citation function to commands
[mothur.git] / consensuscommand.h
1 #ifndef CONCENSUSCOMMAND_H
2 #define CONCENSUSCOMMAND_H
3 /*
4  *  consensuscommand.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 ConcensusCommand : public Command {
18         
19 public:
20         ConcensusCommand(string);       
21         ConcensusCommand();
22         ~ConcensusCommand() {}
23         
24         vector<string> setParameters();
25         string getCommandName()                 { return "concensus";   }
26         string getCommandCategory()             { return "Hidden";              }
27         string getHelpString(); 
28         string getCitation() { return "no citation"; }
29         
30         int execute(); 
31         void help() { m->mothurOut(getHelpString()); }  
32         
33         
34 private:
35         SharedUtil* util;
36         vector<Tree*> t;
37         Tree* consensusTree;
38         bool abort;
39         vector<string> treeSet;         //set containing all members of the tree to start recursion.  filled in getSets().
40         map< vector<string>, int > nodePairs;  //<map of possible combinations these combos are the pcounts or descendants info, to how many times they occured
41                                                                                 // ie. combos FI and EGK would create nodePairs[vector containing F and I] = 1; nodePairs[vector containing E, G and K] = 1
42                                                                                 // if you saw the combo FI again in another tree you would then update nodePairs[vector containing F and I] = 2;
43                                                                                 // requires vectors to be sorted to find key.
44         map< vector<string>, vector< vector<string> > > bestSplit;  //maps a group to its best split
45         map< vector<string>, int > nodePairsInitialRate;
46         map< vector<string>, int > nodePairsInTree;
47         map<string, int>::iterator it;
48         map< vector<string>, int>::iterator it2;
49         string outputFile, notIncluded, filename;
50         ofstream out, out2;
51         int numNodes, numLeaves, count;  //count is the next available spot in the tree vector
52         vector<string> outputNames;
53                                                                                 
54         int getSets();
55         int getSubgroupRating(vector<string>);
56         vector<string> getSmallest(map< vector<string>, int>);
57         vector<string> getNextAvailableSet(vector<string>, vector<string>&);  
58         vector<string> getRestSet(vector<string>, vector<string>);
59         bool isSubset(vector<string>, vector<string>); 
60         int findSpot(string); 
61         int buildConcensusTree(vector<string>);
62         
63 };
64
65 #endif
66