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