From cfb66eb46a9678a751a8f21f3ea740dffd525f5e Mon Sep 17 00:00:00 2001 From: westcott Date: Thu, 19 Mar 2009 15:25:06 +0000 Subject: [PATCH] updated errorchecking so it checks if the parameter is valid for the command. --- errorchecking.cpp | 318 +----------------------------------------- errorchecking.h | 6 - helpcommand.cpp | 3 +- validcommands.cpp | 12 +- validparameter.cpp | 337 +++++++++++++++++++++++++++++++++++++++------ validparameter.h | 36 ++++- 6 files changed, 340 insertions(+), 372 deletions(-) diff --git a/errorchecking.cpp b/errorchecking.cpp index 397bbd2..5f587a9 100644 --- a/errorchecking.cpp +++ b/errorchecking.cpp @@ -38,128 +38,6 @@ void ErrorCheck::refresh() { method = globaldata->getMethod(); randomtree = globaldata->getRandomTree(); sharedfile = globaldata->getSharedFile(); - - - -/* string p[] = { - "phylip", //0 - "column", //1 - "list", //2 - "rabund", //3 - "sabund", //4 - "name", //5 - "order", //6 - "group", //7 - "fasta", //8 - "treefile", //9 - "cutoff", //10 - "precision", //11 - "iters", //12 - "jumble", //13 - "freq", //14 - "method", //15 - "fileroot", //16 - "line", //17 - "label", //18 - "single", //19 - "rarefaction", //20 - "shared", //21 - "summary", //22 - "sharedrarefaction", //23 - "sharedsummary", //24 - "groups", //25 - "abund", //26 - }; - - string c0[] = {p[0],p[5],p[10],p[11]}; - string c1[] = {p[2],p[6],p[7]}; - string c2[] = {p[10],p[11],p[15]}; - string c3[] = {p[8]}; - string c4[] = {p[14],p[17],p[18],p[19],p[26]}; - string c5[] = {p[13],p[14],p[17],p[18],p[21],p[25]}; - string c6[] = {""}; - string c7[] = {""}; - string c8[] = {""}; - string c9[] = {p[12],p[14],p[17],p[18],p[20],p[26]}; - string c10[] = {p[12],p[13],p[17],p[18],p[23]}; - string c11[] = {p[17],p[18],p[22],p[26]}; - string c12[] = {p[13],p[17],p[18],p[24]}; - string c13[] = {""}; - - vector v0 (c0, c0+sizeof(c0)/sizeof(string)); - vector v1 (c1, c1+sizeof(c1)/sizeof(string)); - vector v2 (c2, c2+sizeof(c2)/sizeof(string)); - vector v3 (c3, c3+sizeof(c3)/sizeof(string)); - vector v4 (c4, c4+sizeof(c4)/sizeof(string)); - vector v5 (c5, c5+sizeof(c5)/sizeof(string)); - vector v6 (c6, c6+sizeof(c6)/sizeof(string)); - vector v7 (c7, c7+sizeof(c7)/sizeof(string)); - vector v8 (c8, c8+sizeof(c8)/sizeof(string)); - vector v9 (c9, c9+sizeof(c9)/sizeof(string)); - vector v10 (c10, c10+sizeof(c10)/sizeof(string)); - vector v11 (c11, c11+sizeof(c11)/sizeof(string)); - vector v12 (c12, c12+sizeof(c12)/sizeof(string)); - vector v13 (c13, c13+sizeof(c13)/sizeof(string)); - - vector > allCommands; - allCommands.push_back(v0); - allCommands.push_back(v1); - allCommands.push_back(v2); - allCommands.push_back(v3); - allCommands.push_back(v4); - allCommands.push_back(v5); - allCommands.push_back(v6); - allCommands.push_back(v7); - allCommands.push_back(v8); - allCommands.push_back(v9); - allCommands.push_back(v10); - allCommands.push_back(v11); - allCommands.push_back(v12); - allCommands.push_back(v13); - - string commands[] = { - "read.dist", //0 - "read.otu", //1 - "cluster", //2 - "deconvolute", //3 - "collect.single", //4 - "collect.shared", //5 - "get.group", //6 - "get.label", //7 - "get.line", //8 - "rarefaction.single", //9 - "rarefaction.shared", //10 - "summary.single", //11 - "summary.shared", //12 - "quit" //13 - }; - - for(int i = 0; i < allCommands.size(); i++) - commandParameters[commands[i]] = allCommands.at(i); - - //{Lowerbound(piSent if no lowerbound), Upperbound(piSent if no upperbound), 1 if only the first 2 values, 0 if greater than, 0 if less than}; - piSent = 3.14159; - double ip0[] = {10, piSent, 0, 1, 0}; - double ip1[] = {10, piSent, 0, 1, 0}; - double ip2[] = {0, 1, 1, 0, 0}; - double ip3[] = {1, piSent, 0, 0, 0}; - double ip4[] = {1, piSent, 0, 1, 0}; - double ip5[] = {5, piSent, 0, 1, 0}; - - vector ipv0 (ip0, ip0+sizeof(ip0)/sizeof(double)); - vector ipv1 (ip1, ip1+sizeof(ip1)/sizeof(double)); - vector ipv2 (ip2, ip2+sizeof(ip2)/sizeof(double)); - vector ipv3 (ip3, ip3+sizeof(ip3)/sizeof(double)); - vector ipv4 (ip4, ip4+sizeof(ip4)/sizeof(double)); - vector ipv5 (ip5, ip5+sizeof(ip5)/sizeof(double)); - - intParams[p[11]] = ipv0; - intParams[p[12]] = ipv1; - intParams[p[13]] = ipv2; - intParams[p[14]] = ipv3; - intParams[p[17]] = ipv4; - intParams[p[26]] = ipv5; */ - } /*******************************************************/ @@ -203,49 +81,8 @@ bool ErrorCheck::checkInput(string input) { splitAtEquals(parameter, value); //is it a valid parameter - if (validParameter->isValidParameter(parameter) != true) { return false; } - //if(!validCommandParameter(parameter,commandName)) { - // cout << "'" << parameter << "' is not a valid parameter for the " << commandName << " command.\n"; - // return false; - //} - //if(!validParameterValue(value, parameter)) { - // if(parameter.compare("precision") == 0) - // cout << "The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n"; - // else { - /* vector bounds = intParams[parameter]; - double a = bounds.at(0); - double b = bounds.at(1); - double c = bounds.at(2); - double d = bounds.at(3); - double e = bounds.at(4); - cout << "The '" << parameter << "' parameter needs to be "; - if(c == 1) - cout << "either '" << a << "' or '" << b << "'.\n"; - else - { - if(a != piSent) - { - cout << ">"; - if(d != 0) - cout << "="; - cout << " '" << a << "'"; - } - if(b == piSent) - cout << ".\n"; - else if(a != piSent) - cout << " and "; - if(b != piSent) - { - cout << "<"; - if(e != 0) - cout << "="; - cout << " '" << b << ".\n"; - } - } - } - return false; - } */ - + if (validParameter->isValidParameter(parameter, commandName) != true) { return false; } + if (parameter == "phylip" ) { phylipfile = value; } if (parameter == "column" ) { columnfile = value; } if (parameter == "list" ) { listfile = value; } @@ -275,48 +112,8 @@ bool ErrorCheck::checkInput(string input) { value = optionText; splitAtEquals(parameter, value); //is it a valid parameter - if (validParameter->isValidParameter(parameter) != true) { return false; } - // if(!validCommandParameter(parameter,commandName)) { - // cout << "'" << parameter << "' is not a valid parameter for the " << commandName << " command.\n"; - // return false; - // } - /* if(!validParameterValue(value, parameter)) { - if(parameter.compare("precision") == 0) - cout << "The precision parameter can only take powers of 10 as a value (e.g. 10,1000,1000, etc.)\n"; - else { - vector bounds = intParams[parameter]; - double a = bounds.at(0); - double b = bounds.at(1); - double c = bounds.at(2); - double d = bounds.at(3); - double e = bounds.at(4); - cout << "The '" << parameter << "' parameter needs to be "; - if(c == 1) - cout << "either '" << a << "' or '" << b << "'.\n"; - else - { - if(a != piSent) - { - cout << ">"; - if(d != 0) - cout << "="; - cout << " '" << a << "'"; - } - if(b == piSent) - cout << ".\n"; - else if(a != piSent) - cout << " and "; - if(b != piSent) - { - cout << "<"; - if(e != 0) - cout << "="; - cout << " '" << b << ".\n"; - } - } - } - return false; - }*/ + if (validParameter->isValidParameter(parameter, commandName) != true) { return false; } + if (parameter == "phylip" ) { phylipfile = value; } if (parameter == "column" ) { columnfile = value; } if (parameter == "list" ) { listfile = value; } @@ -491,113 +288,6 @@ void ErrorCheck::validateReadFiles() { } /*******************************************************/ -/****************************************************** -//This function checks to see if the given paramter -//is a valid paramter for the given command. -bool ErrorCheck::validCommandParameter(string parameter, string commandName) { - try { - for(int i = 0; i < commandParameters[commandName].size(); i++) - if(parameter.compare(commandParameters[commandName][i]) == 0) - return true; - return false; - } - - catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateReadFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the ErrorCheck class function validateReadFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } -} -/*******************************************************/ - -/****************************************************** -//This function checks to see if the given paramter value -//is convertable into an int if that parameter requires it. -bool ErrorCheck::validParameterValue(string value, string parameter) { - try { - int pVal; - if(intParams.count(parameter) == 1) - { - vector bounds = intParams[parameter]; - bool valid = convertTest(value, pVal); - if(!valid) - return false; - if(parameter.compare("precision") == 0) - { - double logNum = log10((double)pVal); - double diff = (double)((int)logNum - logNum); - if(diff != 0) - return false; - } - double a = bounds.at(0); - double b = bounds.at(1); - double c = bounds.at(2); - double d = bounds.at(3); - double e = bounds.at(4); - bool a0 = pVal > a; - bool a1 = pVal >= a; - bool b0 = pVal < b; - bool b1 = pVal <= b; - - if(c != 1) - { - if(a == piSent && b == piSent) - return true; - if(a != piSent && b == piSent) - { - if(d == 0) - return a0; - else - return a1; - } - else if(a == piSent && b != piSent) - { - if(e == 0) - return b0; - else - return b1; - } - else - { - if(d == 0 && e == 0) - return (a0 && b0); - else if(d == 0 && e == 1) - return (a0 && b1); - else if(d == 1 && e == 0) - return (a1 && b0); - else - return (a1 && b1); - } - } - else - { - if(a == piSent && b == piSent) - return true; - if(a != piSent && b == piSent) - return (pVal == a); - else if(a == piSent && b != piSent) - return (pVal == b); - else - return (pVal == a || pVal == b); - } - } - return true; - } - - catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the ErrorCheck class Function validateReadFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - catch(...) { - cout << "An unknown error has occurred in the ErrorCheck class function validateReadFiles. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } -} -/*******************************************************/ - /******************************************************/ //This function checks to make sure the user entered appropriate // format parameters on a distfile read diff --git a/errorchecking.h b/errorchecking.h index 50cc005..4c9fe86 100644 --- a/errorchecking.h +++ b/errorchecking.h @@ -26,8 +26,6 @@ class ErrorCheck { ValidCommands* validCommand; ValidParameters* validParameter; void validateReadFiles(); - // bool validCommandParameter(string, string); - // bool validParameterValue(string, string); void validateReadDist(); void validateReadPhil(); void validateParseFiles(); @@ -40,9 +38,5 @@ class ErrorCheck { bool errorFree; vector sharedGroups; - // map > commandParameters; - /// map > intParams; - // double piSent; - }; #endif diff --git a/helpcommand.cpp b/helpcommand.cpp index e04f636..a0b35d0 100644 --- a/helpcommand.cpp +++ b/helpcommand.cpp @@ -39,7 +39,7 @@ int HelpCommand::execute(){ }else if (globaldata->helpRequest == "read.otu") { cout << "The read.otu command must be run before you execute a collect.single, rarefaction.single, summary.single, " << "\n"; cout << "collect.shared, rarefaction.shared or summary.shared command. Mothur will generate a .list, .rabund and .sabund upon completion of the cluster command " << "\n"; - cout << "or you may use your own. The read.otu command parameter options are list, rabund, sabund, group, order, line and label." << "\n"; + cout << "or you may use your own. The read.otu command parameter options are list, rabund, sabund, shared, group, order, line and label." << "\n"; cout << "The read.otu command can be used in two ways. The first is to read a list, rabund or sabund and run the collect.single, rarefaction.single or summary.single." << "\n"; cout << "For this use the read.otu command should be in the following format: read.otu(list=yourListFile, order=yourOrderFile, label=yourLabels)." << "\n"; cout << "The list, rabund or sabund parameter is required, but you may only use one of them." << "\n"; @@ -106,7 +106,6 @@ int HelpCommand::execute(){ cout << "The get.line command should be in the following format: " << "\n"; cout << "get.line()" << "\n"; cout << "Example get.line()." << "\n"; - cout << "Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq)." << "\n" << "\n"; }else if (globaldata->helpRequest == "rarefaction.single") { cout << "The rarefaction.single command can only be executed after a successful read.otu WTIH ONE EXECEPTION." << "\n"; cout << "The rarefaction.single command can be executed after a successful cluster command. It will use the .list file from the output of the cluster." << "\n"; diff --git a/validcommands.cpp b/validcommands.cpp index b1fac55..b2e07ac 100644 --- a/validcommands.cpp +++ b/validcommands.cpp @@ -19,21 +19,21 @@ ValidCommands::ValidCommands() { commands["read.tree"] = "read.tree"; commands["cluster"] = "cluster"; commands["deconvolute"] = "deconvolute"; - commands["parsimony"] = "parsimony"; - commands["help"] = "help"; - commands["quit"] = "quit"; commands["collect.single"] = "collect.single"; commands["collect.shared"] = "collect.shared"; - commands["get.group"] = "get.group"; - commands["get.label"] = "get.label"; - commands["get.line"] = "get.line"; commands["rarefaction.single"] = "rarefaction.single"; commands["rarefaction.shared"] = "rarefaction.shared"; commands["summary.single"] = "summary.single"; commands["summary.shared"] = "summary.shared"; + commands["parsimony"] = "parsimony"; commands["unifrac.weighted"] = "unifrac.weighted"; commands["unifrac.unweighted"] = "unifrac.unweighted"; commands["libshuff"] = "libshuff"; + commands["get.group"] = "get.group"; + commands["get.label"] = "get.label"; + commands["get.line"] = "get.line"; + commands["help"] = "help"; + commands["quit"] = "quit"; } diff --git a/validparameter.cpp b/validparameter.cpp index 8d7c18e..efbd0a4 100644 --- a/validparameter.cpp +++ b/validparameter.cpp @@ -13,35 +13,21 @@ ValidParameters::ValidParameters() { try { - - parameters["phylip"] = "phylip"; - parameters["column"] = "column"; - parameters["list"] = "list"; - parameters["rabund"] = "rabund"; - parameters["sabund"] = "sabund"; - parameters["shared"] = "shared"; - parameters["name"] = "name"; - parameters["group"] = "group"; - parameters["order"] = "order"; - parameters["fasta"] = "fasta"; - parameters["tree"] = "tree"; - parameters["fileroot"] = "fileroot"; - parameters["cutoff"] = "cutoff"; - parameters["method"] = "method"; - parameters["format"] = "format"; - parameters["precision"] = "precision"; - parameters["label"] = "label"; - parameters["line"] = "line"; - parameters["iters"] = "iters"; - parameters["jumble"] = "jumble"; - parameters["freq"] = "freq"; - parameters["abund"] = "abund"; - parameters["random"] = "random"; - parameters["groups"] = "groups"; - parameters["calc"] = "calc"; - parameters["step"] = "step"; - parameters["form"] = "form"; - + initialReaddist(); + initialReadotu(); + initialReadtree(); + initialCluster(); + initialDeconvolute(); + initialParsimony(); + initialCollectsingle(); + initialCollectshared(); + initialRarefactsingle(); + initialRarefactshared(); + initialSummarysingle(); + initialSummaryshared(); + initialUnifracweighted(); + initialUnifracunweighted(); + initialLibshuff(); } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function ValidParameters. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -58,21 +44,184 @@ ValidParameters::ValidParameters() { ValidParameters::~ValidParameters() {} /***********************************************************************/ -bool ValidParameters::isValidParameter(string parameter) { +bool ValidParameters::isValidParameter(string parameter, string command) { try { - //is the parameter in the map - if ((parameters.find(parameter)) != (parameters.end())) { - return true; - }else{ - cout << parameter << " is not a valid parameter in Mothur. Valid parameters are " << endl; - for (it = parameters.begin(); it != parameters.end(); it++) { - cout << it->first << ", "; - } - cout << endl; - - return false; - } + if (command == "read.dist") { + //is it valid + if ((readdist.find(parameter)) != (readdist.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the read.dist command. Valid parameters are "; + for (it = readdist.begin(); it != readdist.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "read.otu") { + //is it valid + if ((readotu.find(parameter)) != (readotu.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the read.otu command. Valid parameters are "; + for (it = readotu.begin(); it != readotu.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + //are you looking for a calculator for a rarefaction parameter + }else if (command == "read.tree") { + //is it valid + if ((readtree.find(parameter)) != (readtree.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the read.tree command. Valid parameters are "; + for (it = readtree.begin(); it != readtree.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + //are you looking for a calculator for a summary parameter + }else if (command == "cluster") { + //is it valid + if ((cluster.find(parameter)) != (cluster.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the cluster command. Valid parameters are "; + for (it = cluster.begin(); it != cluster.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } //are you looking for a calculator for a sharedsummary parameter + }else if (command == "deconvolute") { + //is it valid + if ((deconvolute.find(parameter)) != (deconvolute.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the deconvolute command. Valid parameter is "; + for (it = deconvolute.begin(); it != deconvolute.end(); it++) { + cout << it->first; + } + cout << endl; + return false; } + }else if (command == "parsimony") { + //is it valid + if ((parsimony.find(parameter)) != (parsimony.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the parsimony command. Valid parameters are "; + for (it = parsimony.begin(); it != parsimony.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "collect.single") { + //is it valid + if ((collectsingle.find(parameter)) != (collectsingle.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the collect.single command. Valid parameters are "; + for (it = collectsingle.begin(); it != collectsingle.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "collect.shared") { + //is it valid + if ((collectshared.find(parameter)) != (collectshared.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the collect.shared command. Valid parameters are "; + for (it = collectshared.begin(); it != collectshared.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "rarefaction.single") { + //is it valid + if ((rarefactsingle.find(parameter)) != (rarefactsingle.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the rarefaction.single command. Valid parameters are "; + for (it = rarefactsingle.begin(); it != rarefactsingle.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "rarefaction.shared") { + //is it valid + if ((rarefactshared.find(parameter)) != (rarefactshared.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the rarefaction.shared command. Valid parameters are "; + for (it = rarefactshared.begin(); it != rarefactshared.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "summary.single") { + //is it valid + if ((summarysingle.find(parameter)) != (summarysingle.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the summary.single command. Valid parameters are "; + for (it = summarysingle.begin(); it != summarysingle.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "summary.shared") { + //is it valid + if ((summaryshared.find(parameter)) != (summaryshared.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the summary.shared command. Valid parameters are "; + for (it = summaryshared.begin(); it != summaryshared.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "unifrac.weighted") { + //is it valid + if ((unifracweighted.find(parameter)) != (unifracweighted.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the unifrac.weighted command. Valid parameters are "; + for (it = unifracweighted.begin(); it != unifracweighted.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "unifrac.unweighted") { + //is it valid + if ((unifracunweighted.find(parameter)) != (unifracunweighted.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the unifrac.unweighted command. Valid parameters are "; + for (it = unifracunweighted.begin(); it != unifracunweighted.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (command == "libshuff") { + //is it valid + if ((libshuff.find(parameter)) != (libshuff.end())) { + return true; + }else { + cout << parameter << " is not a valid parameter for the libshuff command. Valid parameters are "; + for (it = libshuff.begin(); it != libshuff.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + //not a valid paramter + }else if (command == "help") { cout << parameter << " is not a valid parameter for the help command. There are no vaild parameters."; + }else if (command == "quit") { cout << parameter << " is not a valid parameter for the quit command. There are no vaild parameters."; + }else if (command == "get.group") { cout << parameter << " is not a valid parameter for the get.group command. There are no vaild parameters."; + }else if (command == "get.label") { cout << parameter << " is not a valid parameter for the get.label command. There are no vaild parameters."; + }else if (command == "get.line") { cout << parameter << " is not a valid parameter for the get.line command. There are no vaild parameters."; } + + return false; } catch(exception& e) { @@ -86,3 +235,107 @@ bool ValidParameters::isValidParameter(string parameter) { } /***********************************************************************/ +void ValidParameters::initialReaddist() { + readdist["phylip"] = "phylip"; + readdist["column"] = "column"; + readdist["name"] = "name"; + readdist["group"] = "group"; + readdist["cutoff"] = "cutoff"; + readdist["precision"] = "precision"; +} +/***********************************************************************/ +void ValidParameters::initialReadotu() { + readotu["list"] = "list"; + readotu["rabund"] = "rabund"; + readotu["sabund"] = "sabund"; + readotu["shared"] = "shared"; + readotu["group"] = "group"; + readotu["order"] = "order"; + readotu["label"] = "label"; + readotu["line"] = "line"; +} +/***********************************************************************/ +void ValidParameters::initialReadtree() { + readtree["group"] = "group"; + readtree["tree"] = "tree"; +} +/***********************************************************************/ +void ValidParameters::initialCluster() { + cluster["cutoff"] = "cutoff"; + cluster["method"] = "method"; + cluster["precision"] = "precision"; +} +/***********************************************************************/ +void ValidParameters::initialDeconvolute() { + deconvolute["fasta"] = "fasta"; +} +/***********************************************************************/ +void ValidParameters::initialParsimony() { + parsimony["iters"] = "iters"; + parsimony["random"] = "random"; + parsimony["groups"] = "groups"; +} +/***********************************************************************/ +void ValidParameters::initialCollectsingle() { + collectsingle["label"] = "label"; + collectsingle["line"] = "line"; + collectsingle["freq"] = "freq"; + collectsingle["calc"] = "calc"; +} +/***********************************************************************/ +void ValidParameters::initialCollectshared() { + collectshared["label"] = "label"; + collectshared["line"] = "line"; + collectshared["freq"] = "freq"; + collectshared["calc"] = "calc"; + collectshared["jumble"] = "jumble"; +} +/***********************************************************************/ +void ValidParameters::initialRarefactsingle() { + rarefactsingle["label"] = "label"; + rarefactsingle["line"] = "line"; + rarefactsingle["freq"] = "freq"; + rarefactsingle["calc"] = "calc"; + rarefactsingle["iters"] = "iters"; +} +/***********************************************************************/ +void ValidParameters::initialRarefactshared() { + rarefactshared["label"] = "label"; + rarefactshared["line"] = "line"; + rarefactshared["jumble"] = "jumble"; + rarefactshared["calc"] = "calc"; + rarefactshared["iters"] = "iters"; +} +/***********************************************************************/ +void ValidParameters::initialSummarysingle() { + summarysingle["label"] = "label"; + summarysingle["line"] = "line"; + summarysingle["calc"] = "calc"; +} +/***********************************************************************/ +void ValidParameters::initialSummaryshared() { + summaryshared["label"] = "label"; + summaryshared["line"] = "line"; + summaryshared["calc"] = "calc"; + summaryshared["jumble"] = "jumble"; + +} +/***********************************************************************/ +void ValidParameters::initialUnifracweighted() { + unifracweighted["iters"] = "iters"; + unifracweighted["groups"] = "groups"; +} +/***********************************************************************/ +void ValidParameters::initialUnifracunweighted() { + unifracunweighted["iters"] = "iters"; + unifracunweighted["groups"] = "groups"; +} +/***********************************************************************/ +void ValidParameters::initialLibshuff() { + libshuff["cutoff"] = "cutoff"; + libshuff["iters"] = "iters"; + libshuff["groups"] = "groups"; + libshuff["step"] = "step"; + libshuff["form"] = "form"; +} +/***********************************************************************/ diff --git a/validparameter.h b/validparameter.h index c03c034..c59c157 100644 --- a/validparameter.h +++ b/validparameter.h @@ -23,10 +23,42 @@ class ValidParameters { public: ValidParameters(); ~ValidParameters(); - bool isValidParameter(string); + bool isValidParameter(string, string); + private: - map parameters; + map readdist; + map readotu; + map readtree; + map cluster; + map deconvolute; + map parsimony; + map collectsingle; + map collectshared; + map rarefactsingle; + map rarefactshared; + map summarysingle; + map summaryshared; + map unifracweighted; + map unifracunweighted; + map libshuff; + map::iterator it; + + void initialReaddist(); + void initialReadotu(); + void initialReadtree(); + void initialCluster(); + void initialDeconvolute(); + void initialParsimony(); + void initialCollectsingle(); + void initialCollectshared(); + void initialRarefactsingle(); + void initialRarefactshared(); + void initialSummarysingle(); + void initialSummaryshared(); + void initialUnifracweighted(); + void initialUnifracunweighted(); + void initialLibshuff(); }; -- 2.39.2