]> git.donarmstrong.com Git - mothur.git/blobdiff - parsefastaqcommand.cpp
removed read.dist, read.otu, read.tree and globaldata. added current to defaults...
[mothur.git] / parsefastaqcommand.cpp
index 87ec2d26651749f20153b7854ba7c3930eebd70c..75d6fa01be65bcccf8f176bfd29dcce843efc0e3 100644 (file)
 #include "sequence.hpp"
 
 //**********************************************************************************************************************
-vector<string> ParseFastaQCommand::getValidParameters(){       
+vector<string> ParseFastaQCommand::setParameters(){    
        try {
-               string Array[] =  {"fastq", "outputdir","inputdir"};
-               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               CommandParameter pfastq("fastq", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfastq);
+               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
+               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+               
+               vector<string> myArray;
+               for (int i = 0; i < parameters.size(); i++) {   myArray.push_back(parameters[i].name);          }
                return myArray;
        }
        catch(exception& e) {
-               m->errorOut(e, "ParseFastaQCommand", "getValidParameters");
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
-ParseFastaQCommand::ParseFastaQCommand(){      
-       try {
-               abort = true; calledHelp = true; 
-               vector<string> tempOutNames;
-               outputTypes["fasta"] = tempOutNames;
-               outputTypes["qfile"] = tempOutNames;
-       }
-       catch(exception& e) {
-               m->errorOut(e, "ParseFastaQCommand", "ParseFastaQCommand");
+               m->errorOut(e, "ParseFastaQCommand", "setParameters");
                exit(1);
        }
 }
 //**********************************************************************************************************************
-vector<string> ParseFastaQCommand::getRequiredParameters(){    
+string ParseFastaQCommand::getHelpString(){    
        try {
-               string Array[] =  {"fastq"};
-               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
-               return myArray;
+               string helpString = "";
+               helpString += "The fastq.info command reads a fastq file and creates a fasta and quality file.\n";
+               helpString += "The fastq.info command parameter is fastq, and it is required.\n";
+               helpString += "The fastq.info command should be in the following format: fastq.info(fastaq=yourFastaQFile).\n";
+               helpString += "Example fastq.info(fastaq=test.fastaq).\n";
+               helpString += "Note: No spaces between parameter labels (i.e. fastq), '=' and yourFastQFile.\n";
+               return helpString;
        }
        catch(exception& e) {
-               m->errorOut(e, "ParseFastaQCommand", "getRequiredParameters");
+               m->errorOut(e, "ParseFastaQCommand", "getHelpString");
                exit(1);
        }
 }
 //**********************************************************************************************************************
-vector<string> ParseFastaQCommand::getRequiredFiles(){ 
+ParseFastaQCommand::ParseFastaQCommand(){      
        try {
-               vector<string> myArray;
-               return myArray;
+               abort = true; calledHelp = true; 
+               setParameters();
+               vector<string> tempOutNames;
+               outputTypes["fasta"] = tempOutNames;
+               outputTypes["qfile"] = tempOutNames;
        }
        catch(exception& e) {
-               m->errorOut(e, "ParseFastaQCommand", "getRequiredFiles");
+               m->errorOut(e, "ParseFastaQCommand", "ParseFastaQCommand");
                exit(1);
        }
 }
@@ -66,9 +64,7 @@ ParseFastaQCommand::ParseFastaQCommand(string option){
                if(option == "help") {  help(); abort = true; calledHelp = true; }
                
                else {
-                       //valid paramters for this command
-                       string Array[] =  {"fastq", "outputdir", "inputdir"};
-                       vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+                       vector<string> myArray = setParameters();
                        
                        OptionParser parser(option);
                        map<string,string> parameters = parser.getParameters();
@@ -117,26 +113,6 @@ ParseFastaQCommand::ParseFastaQCommand(string option){
 }
 //**********************************************************************************************************************
 
-void ParseFastaQCommand::help(){
-       try {
-               m->mothurOut("The fastq.info command reads a fastq file and creates a fasta and quality file.\n");
-               m->mothurOut("The fastq.info command parameter is fastq, and it is required.\n");
-               m->mothurOut("The fastq.info command should be in the following format: fastq.info(fastaq=yourFastaQFile).\n");
-               m->mothurOut("Example fastq.info(fastaq=test.fastaq).\n");
-               m->mothurOut("Note: No spaces between parameter labels (i.e. fastq), '=' and yourFastQFile.\n");
-               m->mothurOutEndLine();
-       }
-       catch(exception& e) {
-               m->errorOut(e, "ParseFastaQCommand", "help");
-               exit(1);
-       }
-}
-//**********************************************************************************************************************
-
-ParseFastaQCommand::~ParseFastaQCommand()      {       /*      do nothing      */      }
-
-//**********************************************************************************************************************
-
 int ParseFastaQCommand::execute(){
        try {
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }