]> git.donarmstrong.com Git - mothur.git/blob - unifracweightedcommand.h
working on parallelizing unifrac.weighted.
[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 #include "sharedutilities.h"
18 #include "fileoutput.h"
19
20
21 class GlobalData;
22
23 class UnifracWeightedCommand : public Command {
24         
25         public:
26                 UnifracWeightedCommand(string);
27                 ~UnifracWeightedCommand() { if (abort == false) {  delete weighted; delete util; } }
28                 int execute();  
29                 void help();
30         
31         private:
32                 struct linePair {
33                         int start;
34                         int num;
35                         linePair(int i, int j) : start(i), num(j) {}
36                 };
37                 vector<linePair*> lines;
38                 
39                 GlobalData* globaldata;
40                 SharedUtil* util;
41                 FileOutput* output;
42                 vector<Tree*> T;           //user trees
43                 vector<double> utreeScores;  //user tree unweighted scores
44                 vector<double> WScoreSig;  //tree weighted score signifigance when compared to random trees - percentage of random trees with that score or lower.
45                 vector<string> groupComb; // AB. AC, BC...
46                 Tree* randT;  //random tree
47                 TreeMap* tmap;
48                 Weighted* weighted;
49                 string sumFile, outputDir;
50                 int iters, numGroups, numComp, counter;
51                 EstOutput userData;                     //weighted score info for user tree
52                 EstOutput randomData;           //weighted score info for random trees
53                 vector< vector<double> > rScores;  //vector<weighted scores for random trees.> each group comb has an entry
54                 vector< vector<double> > uScores;  //vector<weighted scores for user trees.> each group comb has an entry
55                 vector< map<float, float> > rScoreFreq;  //map <weighted score, number of random trees with that score.> -vector entry for each combination.
56                 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                                                                
57                 map<float, float>  validScores;  //map contains scores from random
58                 
59                 bool abort, phylip, random;
60                 string groups, itersString;
61                 vector<string> Groups, outputNames; //holds groups to be used
62                 int processors;
63
64                 
65                 ofstream outSum;
66                 
67                 void printWSummaryFile();
68                 void printWeightedFile();  
69                 void createPhylipFile();
70                 //void removeValidScoresDuplicates();
71                 int findIndex(float, int);
72                 void calculateFreqsCumuls();
73                 int createProcesses(Tree*, Tree*, vector< vector<string> >, vector<double>&, vector< vector<double> >&);
74                 int driver(Tree*, Tree*, vector< vector<string> >, int, int, vector<double>&, vector< vector<double> >&);
75                 
76 };
77
78
79
80 #endif