X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=validcalculator.cpp;h=3e698bf19c67bfe46819df2a1bd10de2a0299b5b;hb=df82ee669d7eb9ae9a1a334339dfab7961cb16c6;hp=70299cb23dca8910e47c9fc8589e8f3d7543f18a;hpb=fd00cd216d3a38ccea22eae258e601df64218b05;p=mothur.git diff --git a/validcalculator.cpp b/validcalculator.cpp index 70299cb..3e698bf 100644 --- a/validcalculator.cpp +++ b/validcalculator.cpp @@ -22,6 +22,9 @@ ValidCalculators::ValidCalculators() { initialVennShared(); initialTreeGroups(); initialBoot(); + initialDistance(); + initialMatrix(); + initialHeat(); } 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"; @@ -139,23 +142,56 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) { 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 "; + 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 == "heat") { + //is it valid + if ((heat.find(calculator)) != (heat.end())) { + return true; + }else { + cout << calculator << " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are "; + for (it = heat.begin(); it != heat.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 "; + 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; } @@ -186,9 +222,13 @@ void ValidCalculators::initialSingle() { single["logseries"] = "logseries"; single["qstat"] = "qstat"; single["bstick"] = "bstick"; + 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) { @@ -208,7 +248,7 @@ void ValidCalculators::initialShared() { shared["sharedchao"] = "sharedchao"; shared["sharedace"] = "sharedace"; shared["jabund"] = "jabund"; - shared["sorabund"] = "sorabund"; + shared["sorabund"] = "sorabund"; shared["jclass"] = "jclass"; shared["sorclass"] = "sorclass"; shared["jest"] = "jest"; @@ -280,7 +320,12 @@ void ValidCalculators::initialSummary() { 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) { @@ -390,7 +435,7 @@ void ValidCalculators::initialVennShared() { void ValidCalculators::initialTreeGroups() { try { treegroup["jabund"] = "jabund"; - treegroup["sorabund"] = "sorabund"; + treegroup["sorabund"] = "sorabund"; treegroup["jclass"] = "jclass"; treegroup["sorclass"] = "sorclass"; treegroup["jest"] = "jest"; @@ -398,7 +443,7 @@ void ValidCalculators::initialTreeGroups() { treegroup["thetayc"] = "thetayc"; treegroup["thetan"] = "thetan"; treegroup["morisitahorn"] = "morisitahorn"; - treegroup["braycurtis"] = "braycurtis"; + 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"; @@ -409,11 +454,59 @@ void ValidCalculators::initialTreeGroups() { exit(1); } } +/********************************************************************/ +void ValidCalculators::initialHeat() { + try { + heat["jabund"] = "jabund"; + heat["sorabund"] = "sorabund"; + heat["jclass"] = "jclass"; + heat["sorclass"] = "sorclass"; + heat["jest"] = "jest"; + heat["sorest"] = "sorest"; + heat["thetayc"] = "thetayc"; + heat["thetan"] = "thetan"; + heat["morisitahorn"] = "morisitahorn"; + heat["braycurtis"] = "braycurtis"; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialHeat. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the ValidCalculator class function initialHeat. 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["sorabund"] = "sorabund"; boot["jclass"] = "jclass"; boot["sorclass"] = "orclass"; boot["jest"] = "jest"; @@ -432,6 +525,22 @@ void ValidCalculators::initialBoot() { 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) { @@ -478,11 +587,24 @@ void ValidCalculators::printCalc(string parameter, ostream& out) { for (it = treegroup.begin(); it != treegroup.end(); it++) { out << it->first << ", "; } + }else if (parameter == "matrix") { + for (it = matrix.begin(); it != matrix.end(); it++) { + out << it->first << ", "; + } + }else if (parameter == "heat") { + for (it = heat.begin(); it != heat.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) {