1 #ifndef UNIFRACWEIGHTEDCOMMAND_H
2 #define UNIFRACWEIGHTEDCOMMAND_H
5 * unifracweightedcommand.h
8 * Created by Sarah Westcott on 2/9/09.
9 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
13 #include "command.hpp"
16 #include "progress.hpp"
17 #include "sharedutilities.h"
18 #include "fileoutput.h"
21 class UnifracWeightedCommand : public Command {
24 UnifracWeightedCommand(string);
25 UnifracWeightedCommand();
26 ~UnifracWeightedCommand() {}
28 vector<string> setParameters();
29 string getCommandName() { return "unifrac.weighted"; }
30 string getCommandCategory() { return "Hypothesis Testing"; }
31 string getOutputFileNameTag(string, string);
32 string getHelpString();
33 string getCitation() { return "Lozupone CA, Hamady M, Kelley ST, Knight R (2007). Quantitative and qualitative beta diversity measures lead to different insights into factors that structure microbial communities. Appl Environ Microbiol 73: 1576-85. \nhttp://www.mothur.org/wiki/Unifrac.weighted"; }
34 string getDescription() { return "generic tests that describes whether two or more communities have the same structure"; }
37 void help() { m->mothurOut(getHelpString()); }
43 linePair(int i, int j) : start(i), num(j) {}
45 vector<linePair> lines;
48 vector<Tree*> T; //user trees
49 vector<double> utreeScores; //user tree unweighted scores
50 vector<double> WScoreSig; //tree weighted score signifigance when compared to random trees - percentage of random trees with that score or lower.
51 vector<string> groupComb; // AB. AC, BC...
52 string sumFile, outputDir;
53 int iters, numGroups, numComp, counter;
54 vector< vector<double> > rScores; //vector<weighted scores for random trees.> each group comb has an entry
55 vector< vector<double> > uScores; //vector<weighted scores for user trees.> each group comb has an entry
56 vector< map<float, float> > rScoreFreq; //map <weighted score, number of random trees with that score.> -vector entry for each combination.
57 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
58 map<float, float> validScores; //map contains scores from random
60 bool abort, phylip, random, includeRoot, subsample, consensus;
61 string groups, itersString, outputForm, treefile, groupfile, namefile;
62 vector<string> Groups, outputNames; //holds groups to be used
63 int processors, subsampleSize, subsampleIters;
65 map<string, string> nameMap;
67 void printWSummaryFile();
68 void printWeightedFile();
69 void createPhylipFile();
70 //void removeValidScoresDuplicates();
71 int findIndex(float, int);
72 void calculateFreqsCumuls();
73 int createProcesses(Tree*, vector< vector<string> >, vector< vector<double> >&);
74 int driver(Tree*, vector< vector<string> >, int, int, vector< vector<double> >&);
75 int runRandomCalcs(Tree*, vector<double>);
76 vector<Tree*> buildTrees(vector< vector<double> >&, int, TreeMap&);
77 int getConsensusTrees(vector< vector<double> >&, int);
78 int getAverageSTDMatrices(vector< vector<double> >&, int);