]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
This is mothur v 1.2.0 - the April ~24, 2009 release
[mothur.git] / validcalculator.cpp
index 4c05e4a8e466e2a99a2628e0ca7e1cf31c5e4bfe..70299cb23dca8910e47c9fc8589e8f3d7543f18a 100644 (file)
@@ -21,6 +21,7 @@ ValidCalculators::ValidCalculators() {
                 initialVennSingle();
                 initialVennShared();
                 initialTreeGroups();
+                initialBoot();
        }
        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";
@@ -138,13 +139,23 @@ 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.groups command in shared mode and will be disregarded. Valid estimators are ";
+                               cout << calculator << " is not a valid estimator for the tree.shared command in shared mode 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 == "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 ";
+                               for (it = boot.begin(); it != boot.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //not a valid parameter
                }else { return false; }
                
@@ -171,11 +182,13 @@ 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["nseqs"]                 = "nseqs";
+               single["coverage"]              = "coverage";
+               
                single["default"]           = "default";
        }
        catch(exception& e) {
@@ -195,7 +208,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";
@@ -203,7 +216,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";
@@ -236,6 +249,7 @@ void ValidCalculators::initialRarefaction() {
                rarefaction["simpson"]          = "simpson";
                rarefaction["bootstrap"]        = "bootstrap";
                rarefaction["nseqs"]            = "nseqs";
+               rarefaction["coverage"]         = "coverage";
                rarefaction["default"]      = "default";
        }
        catch(exception& e) {
@@ -260,12 +274,13 @@ 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["coverage"]             = "coverage";
                summary["default"]          = "default";
        }
        catch(exception& e) {
@@ -285,7 +300,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";
@@ -293,7 +308,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";
@@ -375,7 +390,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";
@@ -383,6 +398,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";
@@ -393,10 +409,91 @@ void ValidCalculators::initialTreeGroups() {
                exit(1);
        }       
 }
-
-
 /********************************************************************/
+void ValidCalculators::initialBoot() {
+       try {   
+               boot["jabund"]                          = "jabund";
+               boot["sorabund"]                = "sorabund";
+               boot["jclass"]                          = "jclass";
+               boot["sorclass"]                        = "orclass";
+               boot["jest"]                            = "jest";
+               boot["sorest"]                          = "sorest";
+               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";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ValidCalculator class function initialBoot. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
+}
 
+/********************************************************************/
+void ValidCalculators::printCalc(string parameter, ostream& out) {
+       try{
+               out << "The available estimators for calc are ";
+               //are you looking for a calculator for a single parameter
+               if (parameter == "single") {
+                       for (it = single.begin(); it != single.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a shared parameter
+               }else if (parameter == "shared") {
+                       for (it = shared.begin(); it != shared.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a rarefaction parameter
+               }else if (parameter == "rarefaction") {
+                       for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a summary parameter
+               }else if (parameter == "summary") {
+                       for (it = summary.begin(); it != summary.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               //are you looking for a calculator for a sharedsummary parameter
+               }else if (parameter == "sharedsummary") {
+                       for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "sharedrarefaction") {
+                       for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "vennsingle") {
+                       for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "vennshared") {
+                       for (it = vennshared.begin(); it != vennshared.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "treegroup") {
+                       for (it = treegroup.begin(); it != treegroup.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }else if (parameter == "boot") {
+                       for (it = boot.begin(); it != boot.end(); it++) {
+                               out << it->first << ", ";
+                       }
+               }
+               out << endl;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the ValidCalculator class function printCalc. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }       
 
-
+}
+/********************************************************************/