]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
version working on mac with .tellg changed to unget for windows
[mothur.git] / validcalculator.cpp
index 14fa775e7398d4be2b5b13a02f111303093c9e9d..3e698bf19c67bfe46819df2a1bd10de2a0299b5b 100644 (file)
@@ -23,6 +23,8 @@ ValidCalculators::ValidCalculators() {
                 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";
@@ -146,6 +148,28 @@ 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 == "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())) {
@@ -201,6 +225,10 @@ void ValidCalculators::initialSingle() {
                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) {
@@ -294,6 +322,10 @@ void ValidCalculators::initialSummary() {
                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) {
@@ -422,6 +454,54 @@ 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 {   
@@ -507,6 +587,14 @@ 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 << ", ";