]> git.donarmstrong.com Git - mothur.git/blobdiff - readotucommand.cpp
added mantel command
[mothur.git] / readotucommand.cpp
index efd7073fae39fd493ef28f22d81d6bfdcf795859..67575561721451bfe172c7235bb172ed24606155 100644 (file)
@@ -9,15 +9,63 @@
 
 #include "readotucommand.h"
 
+//**********************************************************************************************************************
+vector<string> ReadOtuCommand::getValidParameters(){   
+       try {
+               string Array[] =  {"list","order","shared","relabund","label","group","sabund", "rabund","groups","ordergroup","outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ReadOtuCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+ReadOtuCommand::ReadOtuCommand(){      
+       try {
+               abort = true; calledHelp = true; 
+               vector<string> tempOutNames;
+               outputTypes["rabund"] = tempOutNames;
+               outputTypes["shared"] = tempOutNames;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ReadOtuCommand", "ReadOtuCommand");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> ReadOtuCommand::getRequiredParameters(){        
+       try {
+               string Array[] =  {"list","shared","relabund","sabund","rabund","or"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ChopSeqsCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> ReadOtuCommand::getRequiredFiles(){     
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "ReadOtuCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 ReadOtuCommand::ReadOtuCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                allLines = 1;
                
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -34,7 +82,12 @@ ReadOtuCommand::ReadOtuCommand(string option)  {
                        for (it = parameters.begin(); it != parameters.end(); it++) { 
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
-       
+                       
+                       //initialize outputTypes
+                       vector<string> tempOutNames;
+                       outputTypes["rabund"] = tempOutNames;
+                       outputTypes["shared"] = tempOutNames;
+                       
                        globaldata->newRead();
                        
                        //if the user changes the input directory command factory will send this info to us in the output parameter 
@@ -236,7 +289,7 @@ ReadOtuCommand::~ReadOtuCommand(){}
 int ReadOtuCommand::execute(){
        try {
        
-               if (abort == true) {    return 0;       }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
        
                if (globaldata->getFormat() == "shared") {
                        
@@ -255,6 +308,8 @@ int ReadOtuCommand::execute(){
                                //m->mothurOutEndLine();
                        }
                        
+                       outputTypes = shared->getOutputFiles();
+                       
                        delete shared;
                }
                return 0;