]> git.donarmstrong.com Git - mothur.git/blob - parsimonycommand.h
fixed memory leak in parsimony calculator and added progress bars to parsimony and...
[mothur.git] / parsimonycommand.h
1 #ifndef PARSIMONYCOMMAND_H
2 #define PARSIMONYCOMMAND_H
3 /*
4  *  parsimonycommand.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 1/26/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 #include "command.hpp"
13 #include "parsimony.h"
14 #include "treemap.h"
15 #include "progress.hpp"
16
17 using namespace std;
18
19 class GlobalData;
20
21 class ParsimonyCommand : public Command {
22         
23         public:
24                 ParsimonyCommand();     
25                 ~ParsimonyCommand() { delete pars; }
26                 int execute();  
27         
28         private:
29                 GlobalData* globaldata;
30                 vector<Tree*> T;           //user trees
31                 Tree* randT;  //random tree
32                 Tree* copyUserTree; 
33                 TreeMap* tmap; 
34                 TreeMap* savetmap;
35                 Parsimony* pars;
36                 vector<string> groupComb; // AB. AC, BC...
37                 string parsFile, parsFileout, sumFile, randomtree;
38                 int iters, numGroups, numComp, counter;
39                 vector<int> numEachGroup; //vector containing the number of sequences in each group the users wants for random distrib.
40                 vector< vector<float> > userTreeScores; //scores for users trees for each comb.
41                 vector< vector<float> > UScoreSig;  //tree score signifigance when compared to random trees - percentage of random trees with that score or lower.
42                 EstOutput userData;                     //pscore info for user tree
43                 EstOutput randomData;           //pscore info for random trees
44                 map<int, double>  validScores;  //map contains scores from both user and random
45                 vector< map<int, double> > rscoreFreq;  //map <pscore, number of random trees with that score.> -vector entry for each combination.
46                 vector< map<int, double> > uscoreFreq;  //map <pscore, number of user trees with that score.> -vector entry for each combination.
47                 vector< map<int, double> > rCumul;  //map <pscore, cumulative percentage of number of random trees with that score or lower.> -vector entry for each combination.
48                 vector< map<int, double> > uCumul;  //map <pscore, cumulative percentage of number of user trees with that score or lower .> -vector entry for each combination.
49                 map<int, double>::iterator it;
50                 map<int, double>::iterator it2;
51                 
52                 ofstream out, outSum;
53                 ifstream inFile;
54                 
55                 void printParsimonyFile();  
56                 void printUSummaryFile();
57                 void getUserInput();
58                 void setGroups();
59                 void initFile(string);
60                 void output(vector<double>);
61                 void resetFile();
62
63                 
64 };
65
66
67 #endif