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