X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=setcurrentcommand.cpp;fp=setcurrentcommand.cpp;h=16685b24c7c706d0c6cf5aa9d15da2e08e863112;hb=ca9ac1d80c62f57270b0dcd49410ebe08a8aecd6;hp=a4f5c5c1f7ac756c1803bb25dfd7a95133477580;hpb=36a867cbd85d9c276d3c8d13f25a150bbbe2466b;p=mothur.git diff --git a/setcurrentcommand.cpp b/setcurrentcommand.cpp index a4f5c5c..16685b2 100644 --- a/setcurrentcommand.cpp +++ b/setcurrentcommand.cpp @@ -10,47 +10,67 @@ #include "setcurrentcommand.h" //********************************************************************************************************************** -vector SetCurrentCommand::getValidParameters(){ +vector SetCurrentCommand::setParameters(){ try { - string Array[] = {"outputdir","inputdir","clear", "phylip", "column", "list","rabund","sabund","name","group", - "design","order","tree","shared","ordergroup","relabund","fasta","qfile","sff","oligos","accnos","taxonomy"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + + CommandParameter pphylip("phylip", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pphylip); + CommandParameter pcolumn("column", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pcolumn); + CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pfasta); + CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname); + CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pgroup); + CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(plist); + CommandParameter ptaxonomy("taxonomy", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(ptaxonomy); + CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pqfile); + CommandParameter paccnos("accnos", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(paccnos); + CommandParameter prabund("rabund", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(prabund); + CommandParameter psabund("sabund", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(psabund); + CommandParameter pdesign("design", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pdesign); + CommandParameter porder("order", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(porder); + CommandParameter ptree("tree", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(ptree); + CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pshared); + CommandParameter pordergroup("ordergroup", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pordergroup); + CommandParameter prelabund("relabund", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(prelabund); + CommandParameter psff("sff", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(psff); + CommandParameter poligos("oligos", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(poligos); + CommandParameter pclear("clear", "String", "", "", "", "", "",false,false); parameters.push_back(pclear); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); + + vector myArray; + for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } return myArray; } catch(exception& e) { - m->errorOut(e, "SetCurrentCommand", "getValidParameters"); - exit(1); - } -} -//********************************************************************************************************************** -SetCurrentCommand::SetCurrentCommand(){ - try { - abort = true; calledHelp = true; - } - catch(exception& e) { - m->errorOut(e, "SetCurrentCommand", "SetCurrentCommand"); + m->errorOut(e, "SetCurrentCommand", "setParameters"); exit(1); } } //********************************************************************************************************************** -vector SetCurrentCommand::getRequiredParameters(){ +string SetCurrentCommand::getHelpString(){ try { - vector myArray; - return myArray; + string helpString = ""; + helpString += "The set.current command allows you to set the current files saved by mothur.\n"; + helpString += "The set.current command parameters are: clear, phylip, column, list, rabund, sabund, name, group, design, order, tree, shared, ordergroup, relabund, fasta, qfile, sff, oligos, accnos, taxonomy.\n"; + helpString += "The clear paramter is used to indicate which file types you would like to clear values for, multiple types can be separated by dashes.\n"; + helpString += "The set.current command should be in the following format: \n"; + helpString += "set.current(fasta=yourFastaFile) or set.current(fasta=amazon.fasta, clear=name-accnos)\n"; + return helpString; } catch(exception& e) { - m->errorOut(e, "SetCurrentCommand", "getRequiredParameters"); + m->errorOut(e, "SetCurrentCommand", "getHelpString"); exit(1); } } + + //********************************************************************************************************************** -vector SetCurrentCommand::getRequiredFiles(){ +SetCurrentCommand::SetCurrentCommand(){ try { - vector myArray; - return myArray; + abort = true; calledHelp = true; + setParameters(); } catch(exception& e) { - m->errorOut(e, "SetCurrentCommand", "getRequiredFiles"); + m->errorOut(e, "SetCurrentCommand", "SetCurrentCommand"); exit(1); } } @@ -64,9 +84,7 @@ SetCurrentCommand::SetCurrentCommand(string option) { else { //valid paramters for this command - string Array[] = {"outputdir","inputdir","clear", "phylip", "column", "list","rabund","sabund","name","group", - "design","order","tree","shared","ordergroup","relabund","fasta","qfile","sff","oligos","accnos","taxonomy"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + vector myArray = setParameters(); OptionParser parser(option); map parameters = parser.getParameters(); @@ -354,25 +372,6 @@ SetCurrentCommand::SetCurrentCommand(string option) { } //********************************************************************************************************************** -void SetCurrentCommand::help(){ - try { - m->mothurOut("The set.current command allows you to set the current files saved by mothur.\n"); - m->mothurOut("The set.current command parameters are: clear, phylip, column, list, rabund, sabund, name, group, design, order, tree, shared, ordergroup, relabund, fasta, qfile, sff, oligos, accnos, taxonomy.\n"); - m->mothurOut("The clear paramter is used to indicate which file types you would like to clear values for, multiple types can be separated by dashes.\n"); - m->mothurOut("The set.current command should be in the following format: \n"); - m->mothurOut("set.current(fasta=yourFastaFile) or set.current(fasta=amazon.fasta, clear=name-accnos)\n"); - - } - catch(exception& e) { - m->errorOut(e, "SetCurrentCommand", "help"); - exit(1); - } -} - -//********************************************************************************************************************** -SetCurrentCommand::~SetCurrentCommand(){} -//********************************************************************************************************************** - int SetCurrentCommand::execute(){ try {