]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
added shen calculator
[mothur.git] / validcalculator.cpp
index 7d3477f68c2c8eb71c5c42ab27b1aceb7eb81472..edcf8c7a33269ece0758903f4d1fc425da558e97 100644 (file)
@@ -22,6 +22,7 @@ ValidCalculators::ValidCalculators() {
                 initialVennShared();
                 initialTreeGroups();
                 initialBoot();
+                initialDistance();
        }
        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,7 +140,7 @@ 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 << ", ";
                                }
@@ -150,12 +151,23 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        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; }
                
@@ -182,11 +194,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["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) {
@@ -206,7 +224,7 @@ void ValidCalculators::initialShared() {
                shared["sharedchao"]                    = "sharedchao";
                shared["sharedace"]                             = "sharedace";
                shared["jabund"]                                = "jabund";
-               shared["sorensonabund"]                 = "sorensonabund";
+               shared["sorabund"]                              = "sorabund";
                shared["jclass"]                                = "jclass";
                shared["sorclass"]                              = "sorclass";
                shared["jest"]                                  = "jest";
@@ -214,7 +232,7 @@ void ValidCalculators::initialShared() {
                shared["thetayc"]                               = "thetayc";
                shared["thetan"]                                = "thetan";
                shared["kstest"]                                = "kstest";
-               shared["bdiversity"]                    = "bdiversity";
+               shared["whittaker"]                         = "whittaker";
                shared["sharednseqs"]                   = "sharednseqs";
                shared["ochiai"]                                = "ochiai";
                shared["anderberg"]                             = "anderberg";
@@ -247,6 +265,7 @@ void ValidCalculators::initialRarefaction() {
                rarefaction["simpson"]          = "simpson";
                rarefaction["bootstrap"]        = "bootstrap";
                rarefaction["nseqs"]            = "nseqs";
+               rarefaction["coverage"]         = "coverage";
                rarefaction["default"]      = "default";
        }
        catch(exception& e) {
@@ -271,12 +290,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) {
@@ -296,7 +321,7 @@ void ValidCalculators::initialSharedSummary() {
                sharedsummary["sharedchao"]                             = "sharedchao";
                sharedsummary["sharedace"]                              = "sharedace";
                sharedsummary["jabund"]                                 = "jabund";
-               sharedsummary["sorensonabund"]                  = "sorensonabund";
+               sharedsummary["sorabund"]                       = "sorabund";
                sharedsummary["jclass"]                                 = "jclass";
                sharedsummary["sorclass"]                               = "sorclass";
                sharedsummary["jest"]                                   = "jest";
@@ -304,7 +329,7 @@ void ValidCalculators::initialSharedSummary() {
                sharedsummary["thetayc"]                                = "thetayc";
                sharedsummary["thetan"]                                 = "thetan";
                sharedsummary["kstest"]                                 = "kstest";
-               sharedsummary["bdiversity"]                             = "bdiversity";
+               sharedsummary["whittaker"]                              = "whittaker";
                sharedsummary["sharednseqs"]                    = "sharednseqs";
                sharedsummary["ochiai"]                                 = "ochiai";
                sharedsummary["anderberg"]                              = "anderberg";
@@ -386,7 +411,7 @@ void ValidCalculators::initialVennShared() {
 void ValidCalculators::initialTreeGroups() {
        try {   
                treegroup["jabund"]                                     = "jabund";
-               treegroup["sorensonabund"]                      = "sorensonabund";
+               treegroup["sorabund"]                           = "sorabund";
                treegroup["jclass"]                                     = "jclass";
                treegroup["sorclass"]                           = "sorclass";
                treegroup["jest"]                                       = "jest";
@@ -394,6 +419,7 @@ void ValidCalculators::initialTreeGroups() {
                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";
@@ -408,7 +434,7 @@ void ValidCalculators::initialTreeGroups() {
 void ValidCalculators::initialBoot() {
        try {   
                boot["jabund"]                          = "jabund";
-               boot["sorensonabund"]           = "sorensonabund";
+               boot["sorabund"]                        = "sorabund";
                boot["jclass"]                          = "jclass";
                boot["sorclass"]                        = "orclass";
                boot["jest"]                            = "jest";
@@ -416,6 +442,7 @@ void ValidCalculators::initialBoot() {
                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";
@@ -426,6 +453,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) {
@@ -476,7 +519,12 @@ void ValidCalculators::printCalc(string parameter, ostream& out) {
                        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) {