]> git.donarmstrong.com Git - mothur.git/blob - kruskalwalliscommand.h
updated kruskalwallis command
[mothur.git] / kruskalwalliscommand.h
1 /* 
2  * File:   kruskalwalliscommand.h
3  * Author: kiverson
4  *
5  * Created on June 26, 2012, 11:07 AM
6  */
7
8 #ifndef KRUSKALWALLISCOMMAND_H
9 #define KRUSKALWALLISCOMMAND_H
10
11 #include "command.hpp"
12
13     struct groupRank {
14         sstring group;
15         double value;
16         double rank;        
17     };
18
19 class KruskalWallisCommand : public Command {
20    
21 public:
22             
23         KruskalWallisCommand(string);   
24         KruskalWallisCommand();
25         ~KruskalWallisCommand(){}
26         
27         vector<string> setParameters();
28         string getCommandName()                 { return "kruskalwallis";                       }
29         string getCommandCategory()             { return "Hypothesis Testing";  }
30         string getOutputFileNameTag(string, string);
31         string getHelpString(); 
32         string getCitation() { return "http://www.mothur.org/wiki/kruskalwallis"; }
33         string getDescription()         { return "Non-parametric method for testing whether samples originate from the same distribution."; }
34     
35     int execute(); 
36         void help() { m->mothurOut(getHelpString()); }
37     void assignRank(vector<groupRank>);
38     
39 private:
40     string outputDir;
41     vector<int> counts;
42     vector<double> rankSums;
43     vector<double> rankMeans;
44     
45   
46         
47     bool comparevalue(const groupRank &a, const groupRank &b) { return a.value < b.value; }
48     bool equalvalue(const groupRank &a, const groupRank &b) { return a.value == b.value; }
49     bool comparerank(const groupRank &a, const groupRank &b) { return a.rank < b.rank; }
50     bool equalrank(const groupRank &a, const groupRank &b) { return a.rank == b.rank; }
51     bool equalgroup(const groupRank &a, const groupRank &b) { return a.group == b.group; }
52     
53 };
54
55 #endif  /* KRUSKALWALLISCOMMAND_H */
56