]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
fixed Thomas' calculators
[mothur.git] / validcalculator.cpp
index 7a07fd1af9e7eab2b7e7551cb170a852b62aa031..25efa1f2fc784f2fca37e3a478fc2740507df8ab 100644 (file)
@@ -23,6 +23,7 @@ ValidCalculators::ValidCalculators() {
                 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";
@@ -146,6 +147,17 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                                }
                                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())) {
@@ -204,6 +216,7 @@ void ValidCalculators::initialSingle() {
                single["efron"]         = "efron";
                single["boneh"]         = "boneh";
                single["solow"]         = "solow";
+               single["shen"]          = "shen";
                single["default"]           = "default";
        }
        catch(exception& e) {
@@ -300,6 +313,7 @@ void ValidCalculators::initialSummary() {
                summary["efron"]        = "efron";
                summary["boneh"]        = "boneh";
                summary["solow"]        = "solow";
+               summary["shen"]         = "shen";
                summary["default"]          = "default";
        }
        catch(exception& e) {
@@ -428,6 +442,30 @@ void ValidCalculators::initialTreeGroups() {
                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 {   
@@ -513,6 +551,10 @@ 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 == "boot") {
                        for (it = boot.begin(); it != boot.end(); it++) {
                                out << it->first << ", ";