]> git.donarmstrong.com Git - mothur.git/commitdiff
added kruskwalliscommand to Xcode project and fixed parameter issues.
authorSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 12:37:55 +0000 (07:37 -0500)
committerSarah Westcott <mothur.westcott@gmail.com>
Fri, 14 Dec 2012 12:37:55 +0000 (07:37 -0500)
Mothur.xcodeproj/project.pbxproj
kruskalwalliscommand.cpp
kruskalwalliscommand.h

index b689e036afa54c8fdd767cdd8673c45697378f30..0c8c2dd5d35e4fe54d1a705b1874fe2c78594fb5 100644 (file)
@@ -37,6 +37,7 @@
                A73DDBBA13C4A0D1006AAE38 /* clearmemorycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73DDBB913C4A0D1006AAE38 /* clearmemorycommand.cpp */; };
                A73DDC3813C4BF64006AAE38 /* mothurmetastats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73DDC3713C4BF64006AAE38 /* mothurmetastats.cpp */; };
                A741FAD215D1688E0067BCC5 /* sequencecountparser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A741FAD115D1688E0067BCC5 /* sequencecountparser.cpp */; };
+               A7496D2E167B531B00CC7D7C /* kruskalwalliscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7496D2C167B531B00CC7D7C /* kruskalwalliscommand.cpp */; };
                A74A9A9F148E881E00AB5E3E /* spline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74A9A9E148E881E00AB5E3E /* spline.cpp */; };
                A74D36B8137DAFAA00332B0C /* chimerauchimecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D36B7137DAFAA00332B0C /* chimerauchimecommand.cpp */; };
                A74D59A4159A1E2000043046 /* counttable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D59A3159A1E2000043046 /* counttable.cpp */; };
                A73DDC3713C4BF64006AAE38 /* mothurmetastats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mothurmetastats.cpp; sourceTree = "<group>"; };
                A741FAD115D1688E0067BCC5 /* sequencecountparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sequencecountparser.cpp; sourceTree = "<group>"; };
                A741FAD415D168A00067BCC5 /* sequencecountparser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sequencecountparser.h; sourceTree = "<group>"; };
+               A7496D2C167B531B00CC7D7C /* kruskalwalliscommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = kruskalwalliscommand.cpp; sourceTree = "<group>"; };
+               A7496D2D167B531B00CC7D7C /* kruskalwalliscommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kruskalwalliscommand.h; sourceTree = "<group>"; };
                A74A9A9D148E881E00AB5E3E /* spline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spline.h; sourceTree = "<group>"; };
                A74A9A9E148E881E00AB5E3E /* spline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = spline.cpp; sourceTree = "<group>"; };
                A74D36B6137DAFAA00332B0C /* chimerauchimecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chimerauchimecommand.h; sourceTree = "<group>"; };
                                A75790581301749D00A30DAB /* homovacommand.cpp */,
                                A7E9B72C12D37EC400DA6239 /* indicatorcommand.h */,
                                A7E9B72B12D37EC400DA6239 /* indicatorcommand.cpp */,
+                               A7496D2D167B531B00CC7D7C /* kruskalwalliscommand.h */,
+                               A7496D2C167B531B00CC7D7C /* kruskalwalliscommand.cpp */,
                                A7E9B73C12D37EC400DA6239 /* libshuffcommand.h */,
                                A7E9B73B12D37EC400DA6239 /* libshuffcommand.cpp */,
                                A7A0671C156294810095C8C5 /* listotulabelscommand.h */,
                                83F25B0C163B031200ABE73D /* forest.cpp in Sources */,
                                834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */,
                                834D9D5C1656DEC800E7FAB9 /* regularizeddecisiontree.cpp in Sources */,
+                               A7496D2E167B531B00CC7D7C /* kruskalwalliscommand.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 474e82ced7a31ed287a2ecce360bc618c5746827..b321f133a96107023598b71d426506b5cf2f933c 100644 (file)
 //**********************************************************************************************************************
 vector<string> KruskalWallisCommand::setParameters(){  
        try {
-               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
-               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
-        CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
-        CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pshared);    
+               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
+               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
+        CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false,true); parameters.push_back(pgroups);
+        CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","summary",false,true,true); parameters.push_back(pshared);     
                
                vector<string> myArray;
                for (int i = 0; i < parameters.size(); i++) {   myArray.push_back(parameters[i].name);          }
@@ -38,24 +38,19 @@ string KruskalWallisCommand::getHelpString(){
        }
 }
 //**********************************************************************************************************************
-string KruskalWallisCommand::getOutputFileNameTag(string type, string inputName=""){   
-       try {
-        string outputFileName = "";
-               map<string, vector<string> >::iterator it;
+string KruskalWallisCommand::getOutputPattern(string type) {
+    try {
+        string pattern = "";
         
-        //is this a type this command creates
-        it = outputTypes.find(type);
-        if (it == outputTypes.end()) {  m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
-        else {
-            if (type == "summary") {  outputFileName =  "cooccurence.summary"; }
-            else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true;  }
-        }
-        return outputFileName;
-       }
-       catch(exception& e) {
-               m->errorOut(e, "KruskalWallisCommand", "getOutputFileNameTag");
-               exit(1);
-       }
+        if (type == "summary") {  pattern = "[filename],cooccurence.summary"; } 
+        else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true;  }
+        
+        return pattern;
+    }
+    catch(exception& e) {
+        m->errorOut(e, "KruskalWallisCommand", "getOutputPattern");
+        exit(1);
+    }
 }
 //**********************************************************************************************************************
 KruskalWallisCommand::KruskalWallisCommand(){  
@@ -155,7 +150,9 @@ int KruskalWallisCommand::execute(){
                set<string> userLabels = labels;
 
         ofstream out;
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + getOutputFileNameTag("summary");
+        map<string,string> variables;
+        variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(sharedfile));
+               string outputFileName = getOutputFileName("summary",variables);
         m->openOutputFile(outputFileName, out);
         outputNames.push_back(outputFileName);  outputTypes["summary"].push_back(outputFileName);
         out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
index da1166ed16a787adfaaf8a2e183afc8724f6f0a0..feefebd58fdb5650f41e9642a63e6dc68d011a24 100644 (file)
@@ -24,7 +24,7 @@ public:
        vector<string> setParameters();
        string getCommandName()                 { return "kruskalwallis";                       }
        string getCommandCategory()             { return "Hypothesis Testing";  }
-       string getOutputFileNameTag(string, string);
+    string getOutputPattern(string);   
        string getHelpString(); 
        string getCitation() { return "http://www.mothur.org/wiki/kruskalwallis"; }
        string getDescription()         { return "Non-parametric method for testing whether samples originate from the same distribution."; }