From b07e5c455cbf6907186dd821f7f33462706bd225 Mon Sep 17 00:00:00 2001 From: Kathryn Iverson Date: Thu, 28 Jun 2012 16:17:15 -0400 Subject: [PATCH] updated kruskalwallis struct --- kruskalwalliscommand.cpp | 8 ++++---- kruskalwalliscommand.h | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/kruskalwalliscommand.cpp b/kruskalwalliscommand.cpp index f67fef8..946701b 100644 --- a/kruskalwalliscommand.cpp +++ b/kruskalwalliscommand.cpp @@ -7,7 +7,7 @@ #include "kruskalwalliscommand.h" //********************************************************************************************************************** -vector KruskalWallisCommand::setParameters(){ +/*vector KruskalWallisCommand::setParameters(){ try { CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); @@ -117,7 +117,7 @@ KruskalWallisCommand::KruskalWallisCommand(string option) { m->errorOut(e, "KruskalWallisCommand", "KruskalWallisCommand"); exit(1); } -} +}**/ //********************************************************************************************************************** int KruskalWallisCommand::execute(){ try { @@ -176,7 +176,7 @@ int KruskalWallisCommand::execute(){ void KruskalWallisCommand::assignRank(vector &vec) { try { double rank = 1; - double numRanks, avgRank; + double numRanks, avgRank, j; vector::iterator it, oldit; sort (vec.begin(), vec.end(), comparevalue); @@ -186,7 +186,7 @@ void KruskalWallisCommand::assignRank(vector &vec) { while ( it != vec.end() ) { j = rank; oldit = it; - if (!equalvalue(*it, *it+1)) { *it->rank = rank; rank++; it++; } + if (!equalvalue(*it, *it+1)) { *it->rank = rank; rank=rank+1; it++; } else { while(equalrank(*it, *it+1)) { j = j + (j+1.0); diff --git a/kruskalwalliscommand.h b/kruskalwalliscommand.h index 3b5fdce..1aadb16 100644 --- a/kruskalwalliscommand.h +++ b/kruskalwalliscommand.h @@ -11,7 +11,6 @@ #include "command.hpp" - class KruskalWallisCommand : public Command { public: @@ -29,17 +28,19 @@ public: string getDescription() { return "Non-parametric method for testing whether samples originate from the same distribution."; } struct groupRank { - sstring group; + string group; double value; double rank; }; int execute(); void help() { m->mothurOut(getHelpString()); } - void assignRank(vector); + void assignRank(vector&); + private: string outputDir; + bool abort; vector counts; vector rankSums; vector rankMeans; -- 2.39.2