X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=validcalculator.cpp;h=99cd47a13bbc78b86b9332c24337d4dd2b726a42;hb=b22853b5cfbf5c47949ad2a084f2fad88b2e4be4;hp=a875900411bd5b5b3678927e07acbd4e9cd9b9e6;hpb=f20505bcd9f07e0b5f967be0e8d414076d9a5678;p=mothur.git diff --git a/validcalculator.cpp b/validcalculator.cpp index a875900..99cd47a 100644 --- a/validcalculator.cpp +++ b/validcalculator.cpp @@ -20,6 +20,10 @@ ValidCalculators::ValidCalculators() { initialSharedSummary(); initialVennSingle(); initialVennShared(); + initialTreeGroups(); + initialBoot(); + initialDistance(); + initialMatrix(); } 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"; @@ -132,6 +136,50 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) { } 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 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 == "matrix") { + //is it valid + if ((matrix.find(calculator)) != (matrix.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are "; + for (it = matrix.begin(); it != matrix.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 and will be disregarded. Valid estimators are "; + for (it = boot.begin(); it != boot.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } + }else if (parameter == "distance") { + //is it valid + if ((distance.find(calculator)) != (distance.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the distance command and will be disregarded. Valid calculators are "; + for (it = distance.begin(); it != distance.end(); it++) { + cout << it->first << ", "; + } + cout << endl; + return false; } //not a valid parameter }else { return false; } @@ -158,11 +206,17 @@ void ValidCalculators::initialSingle() { single["simpson"] = "simpson"; single["bergerparker"] = "bergerparker"; single["bootstrap"] = "bootstrap"; - single["geom"] = "geom"; - single["logsd"] = "logsd"; + single["geometric"] = "geometric"; + single["logseries"] = "logseries"; single["qstat"] = "qstat"; single["bstick"] = "bstick"; - single["nseqs"] = "nseqs"; + single["goodscoverage"] = "goodscoverage"; + single["nseqs"] = "nseqs"; + single["coverage"] = "coverage"; + single["efron"] = "efron"; + single["boneh"] = "boneh"; + single["solow"] = "solow"; + single["shen"] = "shen"; single["default"] = "default"; } catch(exception& e) { @@ -181,24 +235,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["sharedkstest"] = "sharedkstest"; - shared["sharedbdiversity"] = "sharedbdiversity"; + shared["jabund"] = "jabund"; + shared["sorabund"] = "sorabund"; + shared["jclass"] = "jclass"; + shared["sorclass"] = "sorclass"; + shared["jest"] = "jest"; + shared["sorest"] = "sorest"; + shared["thetayc"] = "thetayc"; + shared["thetan"] = "thetan"; + shared["kstest"] = "kstest"; + shared["whittaker"] = "whittaker"; shared["sharednseqs"] = "sharednseqs"; - shared["sharedochiai"] = "sharedochiai"; - shared["sharedanderberg"] = "sharedanderberg"; - shared["sharedkulczynski"] = "sharedkulczynski"; - shared["sharedkulczynskicody"] = "sharedkulczynskicody"; - shared["sharedlennon"] = "sharedlennon"; - shared["sharedmorisitahorn"] = "sharedmorisitahorn"; - shared["sharedbraycurtis"] = "sharedbraycurtis"; + 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) { @@ -223,6 +277,7 @@ void ValidCalculators::initialRarefaction() { rarefaction["simpson"] = "simpson"; rarefaction["bootstrap"] = "bootstrap"; rarefaction["nseqs"] = "nseqs"; + rarefaction["coverage"] = "coverage"; rarefaction["default"] = "default"; } catch(exception& e) { @@ -247,12 +302,18 @@ void ValidCalculators::initialSummary() { summary["npshannon"] = "npshannon"; summary["simpson"] = "simpson"; summary["bergerparker"] = "bergerparker"; - summary["geom"] = "geom"; + summary["geometric"] = "geometric"; summary["bootstrap"] = "bootstrap"; - summary["logsd"] = "logsd"; + summary["logseries"] = "logseries"; summary["qstat"] = "qstat"; summary["bstick"] = "bstick"; summary["nseqs"] = "nseqs"; + summary["goodscoverage"]= "goodscoverage"; + summary["coverage"] = "coverage"; + summary["efron"] = "efron"; + summary["boneh"] = "boneh"; + summary["solow"] = "solow"; + summary["shen"] = "shen"; summary["default"] = "default"; } catch(exception& e) { @@ -271,24 +332,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["sharedkstest"] = "sharedkstest"; - sharedsummary["sharedbdiversity"] = "sharedbdiversity"; + sharedsummary["jabund"] = "jabund"; + sharedsummary["sorabund"] = "sorabund"; + sharedsummary["jclass"] = "jclass"; + sharedsummary["sorclass"] = "sorclass"; + sharedsummary["jest"] = "jest"; + sharedsummary["sorest"] = "sorest"; + sharedsummary["thetayc"] = "thetayc"; + sharedsummary["thetan"] = "thetan"; + sharedsummary["kstest"] = "kstest"; + sharedsummary["whittaker"] = "whittaker"; sharedsummary["sharednseqs"] = "sharednseqs"; - sharedsummary["sharedochiai"] = "sharedochiai"; - sharedsummary["sharedanderberg"] = "sharedanderberg"; - sharedsummary["sharedkulczynski"] = "sharedkulczynski"; - sharedsummary["sharedkulczynskicody"] = "sharedkulczynskicody"; - sharedsummary["sharedlennon"] = "sharedlennon"; - sharedsummary["sharedmorisitahorn"] = "sharedmorisitahorn"; - sharedsummary["sharedbraycurtis"] = "sharedbraycurtis"; + 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) { @@ -326,9 +387,9 @@ void ValidCalculators::initialVennSingle() { try { vennsingle["sobs"] = "sobs"; vennsingle["chao"] = "chao"; - vennsingle["ace"] = "ace"; + vennsingle["ace"] = "ace"; vennsingle["jack"] = "jack"; - vennsingle["default"] = "default"; + 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"; @@ -359,6 +420,158 @@ void ValidCalculators::initialVennShared() { } /********************************************************************/ +void ValidCalculators::initialTreeGroups() { + try { + treegroup["jabund"] = "jabund"; + treegroup["sorabund"] = "sorabund"; + treegroup["jclass"] = "jclass"; + treegroup["sorclass"] = "sorclass"; + treegroup["jest"] = "jest"; + treegroup["sorest"] = "sorest"; + treegroup["thetayc"] = "thetayc"; + treegroup["thetan"] = "thetan"; + treegroup["morisitahorn"] = "morisitahorn"; + treegroup["braycurtis"] = "braycurtis"; + } + 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::initialMatrix() { + try { + matrix["jabund"] = "jabund"; + matrix["sorabund"] = "sorabund"; + matrix["jclass"] = "jclass"; + matrix["sorclass"] = "sorclass"; + matrix["jest"] = "jest"; + matrix["sorest"] = "sorest"; + matrix["thetayc"] = "thetayc"; + matrix["thetan"] = "thetan"; + matrix["morisitahorn"] = "morisitahorn"; + matrix["braycurtis"] = "braycurtis"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialMatrix. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialMatrix. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/********************************************************************/ +void ValidCalculators::initialBoot() { + try { + boot["jabund"] = "jabund"; + boot["sorabund"] = "sorabund"; + boot["jclass"] = "jclass"; + boot["sorclass"] = "orclass"; + boot["jest"] = "jest"; + boot["sorest"] = "sorest"; + boot["thetayc"] = "thetayc"; + boot["thetan"] = "thetan"; + boot["morisitahorn"] = "morisitahorn"; + boot["braycurtis"] = "braycurtis"; + } + 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::initialDistance() { + try { + distance["nogaps"] = "nogaps"; + distance["eachgap"] = "eachgap"; + distance["onegap"] = "onegap"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialDistance. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialDistance. 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 << ", "; + } + }else if (parameter == "distance") { + for (it = distance.begin(); it != distance.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); + } +} +/********************************************************************/