]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
added get.repseqs command, started matrix output command
[mothur.git] / validcalculator.cpp
index edcf8c7a33269ece0758903f4d1fc425da558e97..99cd47a13bbc78b86b9332c24337d4dd2b726a42 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())) {
@@ -430,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 {