]> git.donarmstrong.com Git - mothur.git/blobdiff - validcalculator.cpp
added sharedochiai and sharedanderberg calculators
[mothur.git] / validcalculator.cpp
index 8659be3d85f1956f788f13355bea8f9fa67e5052..b29ff5797f9db61b3c3cb31e32628cc251c3b95e 100644 (file)
@@ -42,37 +42,72 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
                        //is it valid
                        if ((single.find(calculator)) != (single.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid single estimator. Valid single estimators are collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson." << endl; return false; }
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ";
+                               for (it = single.begin(); it != single.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //are you looking for a calculator for a shared parameter
                }else if (parameter == "shared") {
                        //is it valid
                        if ((shared.find(calculator)) != (shared.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid shared estimator.  Valid shared estimators are sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN." << endl; return false; }
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the collect.shared command and will be disregarded.  Valid estimators are ";
+                               for (it = shared.begin(); it != shared.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //are you looking for a calculator for a rarefaction parameter
                }else if (parameter == "rarefaction") {
                        //is it valid
                        if ((rarefaction.find(calculator)) != (rarefaction.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid rarefaction estimator. Valid rarefaction estimators are rarefaction-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson." << endl; return false; }
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ";
+                               for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //are you looking for a calculator for a summary parameter
                }else if (parameter == "summary") {
                        //is it valid
                        if ((summary.find(calculator)) != (summary.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid summary estimator. Valid summary estimators are collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson." << endl; return false; }
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
+                               for (it = summary.begin(); it != summary.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //are you looking for a calculator for a sharedsummary parameter
                }else if (parameter == "sharedsummary") {
                        //is it valid
                        if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid sharedsummary estimator. Valid sharedsummary estimators are: sharedChao-sharedAce-sharedJabund-sharedSorensonAbund-sharedJclass-sharedSorClass-sharedJest-sharedSorEst-SharedThetaYC-SharedThetaN." << endl; return false; }
-
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
+                               for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                }else if (parameter == "sharedrarefaction") {
                        //is it valid
                        if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
                                return true;
-                       }else { cout << calculator << " is not a valid sharedrarefaction estimator. Valid sharedrarefaction estimator is sharedobserved." << endl; return false; }
+                       }else { 
+                               cout << calculator << " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ";
+                               for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
+                                       cout << it->first << ", ";
+                               }
+                               cout << endl;
+                               return false; }
                //not a valid paramter
                }else { return false; }
                
@@ -91,7 +126,7 @@ bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
 void ValidCalculators::initialSingle() {
        try {   
        
-               single["sobs"]  = "sobs";
+               single["sobs"]          = "sobs";
                single["chao"]          = "chao";
                single["ace"]           = "ace";
                single["jack"]          = "jack";
@@ -100,6 +135,7 @@ void ValidCalculators::initialSingle() {
                single["simpson"]       = "simpson";
                single["bootstrap"]     = "bootstrap";
                single["default"]       = "default";
+               single["nseqs"]         = "nseqs";
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -114,16 +150,20 @@ void ValidCalculators::initialSingle() {
 /********************************************************************/
 void ValidCalculators::initialShared() {
        try {   
-               shared["sharedChao"]                    = "sharedChao";
-               shared["sharedAce"]                             = "sharedAce";
-               shared["sharedJabund"]                  = "sharedJabund";
-               shared["sharedSorensonAbund"]   = "sharedSorensonAbund";
-               shared["sharedJclass"]                  = "sharedJclass";
-               shared["sharedSorClass"]                = "sharedSorClass";
-               shared["sharedJest"]                    = "sharedJest";
-               shared["sharedSorEst"]                  = "sharedSorEst";
-               shared["SharedThetaYC"]                 = "SharedThetaYC";
-               shared["SharedThetaN"]                  = "SharedThetaN";
+               shared["sharedsobs"]                    = "sharedsobs";
+               shared["sharedchao"]                    = "sharedchao";
+               shared["sharedace"]                             = "sharedace";
+               shared["sharedjabund"]                  = "sharedjabund";
+               shared["sharedsorensonabund"]   = "sharedsorensonabund";
+               shared["sharedjclass"]                  = "sharedjclass";
+               shared["sharedsorclass"]                = "sharedsorclass";
+               shared["sharedjest"]                    = "sharedjest";
+               shared["sharedsorest"]                  = "sharedsorest";
+               shared["sharedthetayc"]                 = "sharedthetayc";
+               shared["sharedthetan"]                  = "sharedthetan";
+               shared["sharednseqs"]                   = "sharednseqs";
+               shared["sharedochiai"]                  = "sharedochiai";
+               shared["sharedanderberg"]               = "sharedanderberg";
                shared["default"]                   = "default";
        }
        catch(exception& e) {
@@ -147,6 +187,7 @@ void ValidCalculators::initialRarefaction() {
                rarefaction["npshannon"]        = "npshannon";
                rarefaction["simpson"]          = "simpson";
                rarefaction["bootstrap"]        = "bootstrap";
+               rarefaction["nseqs"]            = "nseqs";
                rarefaction["default"]      = "default";
        }
        catch(exception& e) {
@@ -171,6 +212,7 @@ void ValidCalculators::initialSummary() {
                summary["npshannon"]    = "npshannon";
                summary["simpson"]              = "simpson";
                summary["bootstrap"]    = "bootstrap";
+               summary["nseqs"]                = "nseqs";
                summary["default"]          = "default";
        }
        catch(exception& e) {
@@ -186,16 +228,20 @@ void ValidCalculators::initialSummary() {
 /********************************************************************/
 void ValidCalculators::initialSharedSummary() {
        try {   
-               sharedsummary["sharedChao"]                             = "sharedChao";
-               sharedsummary["sharedAce"]                              = "sharedAce";
-               sharedsummary["sharedJabund"]                   = "sharedJabund";
-               sharedsummary["sharedSorensonAbund"]    = "sharedSorensonAbund";
-               sharedsummary["sharedJclass"]                   = "sharedJclass";
-               sharedsummary["sharedSorClass"]                 = "sharedSorClass";
-               sharedsummary["sharedJest"]                             = "sharedJest";
-               sharedsummary["sharedSorEst"]                   = "sharedSorEst";
-               sharedsummary["SharedThetaYC"]                  = "SharedThetaYC";
-               sharedsummary["SharedThetaN"]                   = "SharedThetaN";
+               sharedsummary["sharedsobs"]                             = "sharedsobs";
+               sharedsummary["sharedchao"]                             = "sharedchao";
+               sharedsummary["sharedace"]                              = "sharedace";
+               sharedsummary["sharedjabund"]                   = "sharedjabund";
+               sharedsummary["sharedsorensonabund"]    = "sharedsorensonabund";
+               sharedsummary["sharedjclass"]                   = "sharedjclass";
+               sharedsummary["sharedsorclass"]                 = "sharedsorclass";
+               sharedsummary["sharedjest"]                             = "sharedjest";
+               sharedsummary["sharedsorest"]                   = "sharedsorest";
+               sharedsummary["sharedthetayc"]                  = "sharedthetayc";
+               sharedsummary["sharedthetan"]                   = "sharedthetan";
+               sharedsummary["sharednseqs"]                    = "sharednseqs";
+               sharedsummary["sharedochiai"]                   = "sharedochiai";
+               sharedsummary["sharedanderberg"]                = "sharedanderberg";
                sharedsummary["default"]                                = "default";
        }
        catch(exception& e) {
@@ -214,6 +260,7 @@ void ValidCalculators::initialSharedSummary() {
 void ValidCalculators::initialSharedRarefact() {
        try {   
                sharedrarefaction["sharedobserved"]     = "sharedobserved";
+               sharedrarefaction["sharednseqs"]        = "sharednseqs";
                sharedrarefaction["default"]        = "default";
        }
        catch(exception& e) {