]> git.donarmstrong.com Git - mothur.git/blob - unifracunweightedcommand.h
Merge remote-tracking branch 'mothur/master'
[mothur.git] / unifracunweightedcommand.h
1 #ifndef UNIFRACUNWEIGHTEDCOMMAND_H
2 #define UNIFRACUNWEIGHTEDCOMMAND_H
3
4 /*
5  *  unifracunweightedcommand.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 "unweighted.h"
15 #include "counttable.h"
16 #include "sharedutilities.h"
17 #include "fileoutput.h"
18 #include "readtree.h"
19
20 class UnifracUnweightedCommand : public Command {
21         
22         public:
23                 UnifracUnweightedCommand(string);       
24                 UnifracUnweightedCommand();
25                 ~UnifracUnweightedCommand() {}
26         
27                 vector<string> setParameters();
28                 string getCommandName()                 { return "unifrac.unweighted";          }
29                 string getCommandCategory()             { return "Hypothesis Testing";          }
30                 string getOutputFileNameTag(string, string);
31         string getHelpString(); 
32                 string getCitation() { return "Lozupone C, Knight R (2005). UniFrac: a new phylogenetic method for comparing microbial communities. Appl Environ Microbiol 71: 8228-35. \nhttp://www.mothur.org/wiki/Unifrac.unweighted"; }
33                 string getDescription()         { return "generic tests that describes whether two or more communities have the same structure"; }
34
35                 int execute();
36                 void help() { m->mothurOut(getHelpString()); }
37         
38         
39         private:
40                 FileOutput* output;
41                 vector<Tree*> T;           //user trees
42                 CountTable* ct;
43                 string sumFile, allGroups;
44                 vector<string> groupComb; // AB. AC, BC...
45                 int iters, numGroups, numComp, counter, processors, subsampleSize, subsampleIters;
46                 vector< vector<float> > utreeScores; //scores for users trees for each comb.
47                 vector< vector<float> > UWScoreSig;  //tree score signifigance when compared to random trees - percentage of random trees with that score or higher.
48                 map<float, float>  validScores;  //map contains scores from random
49                 vector< map<float, float> > rscoreFreq;  //map <unweighted score, number of random trees with that score.> -vector entry for each combination.
50                 vector< map<float, float> > rCumul;  //map <unweighted score, cumulative percentage of number of random trees with that score or higher.> -vector entry for each combination.
51                 
52                 bool abort, phylip, random, includeRoot, consensus, subsample;
53                 string groups, itersString, outputDir, outputForm, treefile, groupfile, namefile, countfile;
54                 vector<string> Groups, outputNames; //holds groups to be used
55
56                 ofstream outSum, out;
57                 ifstream inFile;
58                 
59         int runRandomCalcs(Tree*, vector<double>);
60                 void printUWSummaryFile(int);
61                 void printUnweightedFile();
62                 void createPhylipFile(int);
63         vector<Tree*> buildTrees(vector< vector<double> >&, int, CountTable&);
64         int getConsensusTrees(vector< vector<double> >&, int);
65         int getAverageSTDMatrices(vector< vector<double> >&, int);
66                 
67 };
68
69 #endif