X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=validcalculator.cpp;h=25cc5c5868e46a9659fc88e924a6f03baf48b7da;hb=e4827e0945cbda536064e5a345996b2a7dfcbb81;hp=7f83ac7107757f35f5e29fe8b4de5b99237f4f8c;hpb=9ca2caadbeac83bb84b3330d9204b1b659d62941;p=mothur.git diff --git a/validcalculator.cpp b/validcalculator.cpp index 7f83ac7..25cc5c5 100644 --- a/validcalculator.cpp +++ b/validcalculator.cpp @@ -18,6 +18,10 @@ ValidCalculators::ValidCalculators() { initialSharedRarefact(); initialSummary(); initialSharedSummary(); + initialVennSingle(); + initialVennShared(); + initialTreeGroups(); + initialBoot(); } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -108,7 +112,51 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) { } cout << endl; return false; } - //not a valid paramter + }else if (parameter == "vennsingle") { + //is it valid + if ((vennsingle.find(calculator)) != (vennsingle.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are "; + for (it = vennsingle.begin(); it != vennsingle.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (parameter == "vennshared") { + //is it valid + if ((vennshared.find(calculator)) != (vennshared.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are "; + for (it = vennshared.begin(); it != vennshared.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (parameter == "treegroup") { + //is it valid + if ((treegroup.find(calculator)) != (treegroup.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the tree.shared command in shared mode and will be disregarded. Valid estimators are "; + for (it = treegroup.begin(); it != treegroup.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (parameter == "boot") { + //is it valid + if ((boot.find(calculator)) != (boot.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the bootstrap.shared command in shared mode and will be disregarded. Valid estimators are "; + for (it = boot.begin(); it != boot.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + //not a valid parameter }else { return false; } } @@ -125,17 +173,23 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) { /********************************************************************/ void ValidCalculators::initialSingle() { try { - - single["sobs"] = "sobs"; - single["chao"] = "chao"; - single["ace"] = "ace"; - single["jack"] = "jack"; - single["shannon"] = "shannon"; - single["npshannon"] = "npshannon"; - single["simpson"] = "simpson"; - single["bootstrap"] = "bootstrap"; - single["default"] = "default"; - single["nseqs"] = "nseqs"; + single["sobs"] = "sobs"; + single["chao"] = "chao"; + single["ace"] = "ace"; + single["jack"] = "jack"; + single["shannon"] = "shannon"; + single["npshannon"] = "npshannon"; + single["simpson"] = "simpson"; + single["bergerparker"] = "bergerparker"; + single["bootstrap"] = "bootstrap"; + single["geometric"] = "geometric"; + single["logseries"] = "logseries"; + single["qstat"] = "qstat"; + single["bstick"] = "bstick"; + single["nseqs"] = "nseqs"; + single["coverage"] = "coverage"; + + single["default"] = "default"; } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -153,15 +207,24 @@ void ValidCalculators::initialShared() { shared["sharedsobs"] = "sharedsobs"; shared["sharedchao"] = "sharedchao"; shared["sharedace"] = "sharedace"; - shared["sharedjabund"] = "sharedjabund"; - shared["sharedsorensonabund"] = "sharedsorensonabund"; - shared["sharedjclass"] = "sharedjclass"; - shared["sharedsorclass"] = "sharedsorclass"; - shared["sharedjest"] = "sharedjest"; - shared["sharedsorest"] = "sharedsorest"; - shared["sharedthetayc"] = "sharedthetayc"; - shared["sharedthetan"] = "sharedthetan"; + shared["jabund"] = "jabund"; + shared["sorensonabund"] = "sorensonabund"; + shared["jclass"] = "jclass"; + shared["sorclass"] = "sorclass"; + shared["jest"] = "jest"; + shared["sorest"] = "sorest"; + shared["thetayc"] = "thetayc"; + shared["thetan"] = "thetan"; + shared["kstest"] = "kstest"; + shared["bdiversity"] = "bdiversity"; shared["sharednseqs"] = "sharednseqs"; + shared["ochiai"] = "ochiai"; + shared["anderberg"] = "anderberg"; + shared["kulczynski"] = "kulczynski"; + shared["kulczynskicody"] = "kulczynskicody"; + shared["lennon"] = "lennon"; + shared["morisitahorn"] = "morisitahorn"; + shared["braycurtis"] = "braycurtis"; shared["default"] = "default"; } catch(exception& e) { @@ -186,6 +249,7 @@ void ValidCalculators::initialRarefaction() { rarefaction["simpson"] = "simpson"; rarefaction["bootstrap"] = "bootstrap"; rarefaction["nseqs"] = "nseqs"; + rarefaction["coverage"] = "coverage"; rarefaction["default"] = "default"; } catch(exception& e) { @@ -209,8 +273,14 @@ void ValidCalculators::initialSummary() { summary["shannon"] = "shannon"; summary["npshannon"] = "npshannon"; summary["simpson"] = "simpson"; + summary["bergerparker"] = "bergerparker"; + summary["geometric"] = "geometric"; summary["bootstrap"] = "bootstrap"; + summary["logsd"] = "logsd"; + summary["qstat"] = "qstat"; + summary["bstick"] = "bstick"; summary["nseqs"] = "nseqs"; + summary["coverage"] = "coverage"; summary["default"] = "default"; } catch(exception& e) { @@ -229,15 +299,24 @@ void ValidCalculators::initialSharedSummary() { sharedsummary["sharedsobs"] = "sharedsobs"; sharedsummary["sharedchao"] = "sharedchao"; sharedsummary["sharedace"] = "sharedace"; - sharedsummary["sharedjabund"] = "sharedjabund"; - sharedsummary["sharedsorensonabund"] = "sharedsorensonabund"; - sharedsummary["sharedjclass"] = "sharedjclass"; - sharedsummary["sharedsorclass"] = "sharedsorclass"; - sharedsummary["sharedjest"] = "sharedjest"; - sharedsummary["sharedsorest"] = "sharedsorest"; - sharedsummary["sharedthetayc"] = "sharedthetayc"; - sharedsummary["sharedthetan"] = "sharedthetan"; + sharedsummary["jabund"] = "jabund"; + sharedsummary["sorensonabund"] = "sorensonabund"; + sharedsummary["jclass"] = "jclass"; + sharedsummary["sorclass"] = "sorclass"; + sharedsummary["jest"] = "jest"; + sharedsummary["sorest"] = "sorest"; + sharedsummary["thetayc"] = "thetayc"; + sharedsummary["thetan"] = "thetan"; + sharedsummary["kstest"] = "kstest"; + sharedsummary["bdiversity"] = "bdiversity"; sharedsummary["sharednseqs"] = "sharednseqs"; + sharedsummary["ochiai"] = "ochiai"; + sharedsummary["anderberg"] = "anderberg"; + sharedsummary["kulczynski"] = "kulczynski"; + sharedsummary["kulczynskicody"] = "kulczynskicody"; + sharedsummary["lennon"] = "lennon"; + sharedsummary["morisitahorn"] = "morisitahorn"; + sharedsummary["braycurtis"] = "braycurtis"; sharedsummary["default"] = "default"; } catch(exception& e) { @@ -269,7 +348,150 @@ void ValidCalculators::initialSharedRarefact() { } } + +/********************************************************************/ +void ValidCalculators::initialVennSingle() { + try { + vennsingle["sobs"] = "sobs"; + vennsingle["chao"] = "chao"; + vennsingle["ace"] = "ace"; + vennsingle["jack"] = "jack"; + vennsingle["default"] = "default"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/********************************************************************/ +void ValidCalculators::initialVennShared() { + try { + vennshared["sharedsobs"] = "sharedsobs"; + vennshared["sharedchao"] = "sharedchao"; + vennshared["sharedace"] = "sharedace"; + vennshared["default"] = "default"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/********************************************************************/ +void ValidCalculators::initialTreeGroups() { + try { + treegroup["jabund"] = "jabund"; + treegroup["sorensonabund"] = "sorensonabund"; + treegroup["jclass"] = "jclass"; + treegroup["sorclass"] = "sorclass"; + treegroup["jest"] = "jest"; + treegroup["sorest"] = "sorest"; + treegroup["thetayc"] = "thetayc"; + treegroup["thetan"] = "thetan"; + treegroup["morisitahorn"] = "morisitahorn"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialTreeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialTreeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} /********************************************************************/ +void ValidCalculators::initialBoot() { + try { + boot["jabund"] = "jabund"; + boot["sorensonabund"] = "sorensonabund"; + boot["jclass"] = "jclass"; + boot["sorclass"] = "orclass"; + boot["jest"] = "jest"; + boot["sorest"] = "sorest"; + boot["thetayc"] = "thetayc"; + boot["thetan"] = "thetan"; + boot["morisitahorn"] = "morisitahorn"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialBoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialBoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} +/********************************************************************/ +void ValidCalculators::printCalc(string parameter, ostream& out) { + try{ + out << "The available estimators for calc are "; + //are you looking for a calculator for a single parameter + if (parameter == "single") { + for (it = single.begin(); it != single.end(); it++) { + out << it->first << ", "; + } + //are you looking for a calculator for a shared parameter + }else if (parameter == "shared") { + for (it = shared.begin(); it != shared.end(); it++) { + out << it->first << ", "; + } + //are you looking for a calculator for a rarefaction parameter + }else if (parameter == "rarefaction") { + for (it = rarefaction.begin(); it != rarefaction.end(); it++) { + out << it->first << ", "; + } + //are you looking for a calculator for a summary parameter + }else if (parameter == "summary") { + for (it = summary.begin(); it != summary.end(); it++) { + out << it->first << ", "; + } + //are you looking for a calculator for a sharedsummary parameter + }else if (parameter == "sharedsummary") { + for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "sharedrarefaction") { + for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "vennsingle") { + for (it = vennsingle.begin(); it != vennsingle.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "vennshared") { + for (it = vennshared.begin(); it != vennshared.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "treegroup") { + for (it = treegroup.begin(); it != treegroup.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "boot") { + for (it = boot.begin(); it != boot.end(); it++) { + out << it->first << ", "; + } + } + out << endl; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} +/********************************************************************/