5 * Created by Sarah Westcott on 1/5/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "validcalculator.h"
12 /********************************************************************/
13 ValidCalculators::ValidCalculators() {
18 initialSharedRarefact();
20 initialSharedSummary();
23 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
27 cout << "An unknown error has occurred in the ValidCalculator class function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
32 /********************************************************************/
34 ValidCalculators::~ValidCalculators() {}
36 /********************************************************************/
38 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
40 //are you looking for a calculator for a single parameter
41 if (parameter == "single") {
43 if ((single.find(calculator)) != (single.end())) {
45 }else { cout << calculator << " is not a valid single estimator. Valid single estimators are collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson." << endl; return false; }
46 //are you looking for a calculator for a shared parameter
47 }else if (parameter == "shared") {
49 if ((shared.find(calculator)) != (shared.end())) {
51 }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; }
52 //are you looking for a calculator for a rarefaction parameter
53 }else if (parameter == "rarefaction") {
55 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
57 }else { cout << calculator << " is not a valid rarefaction estimator. Valid rarefaction estimators are rarefaction-rchao-race-rjack-rbootstrap-rshannon-rnpshannon-rsimpson." << endl; return false; }
58 //are you looking for a calculator for a summary parameter
59 }else if (parameter == "summary") {
61 if ((summary.find(calculator)) != (summary.end())) {
63 }else { cout << calculator << " is not a valid summary estimator. Valid summary estimators are collect-chao-ace-jack-bootstrap-shannon-npshannon-simpson." << endl; return false; }
64 //are you looking for a calculator for a sharedsummary parameter
65 }else if (parameter == "sharedsummary") {
67 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
69 }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; }
71 }else if (parameter == "sharedrarefaction") {
73 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
75 }else { cout << calculator << " is not a valid sharedrarefaction estimator. Valid sharedrarefaction estimator is sharedobserved." << endl; return false; }
76 //not a valid paramter
77 }else { return false; }
81 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
85 cout << "An unknown error has occurred in the ValidCalculator class function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
90 /********************************************************************/
91 void ValidCalculators::initialSingle() {
94 single["sobs"] = "sobs";
95 single["chao"] = "chao";
96 single["ace"] = "ace";
97 single["jack"] = "jack";
98 single["shannon"] = "shannon";
99 single["npshannon"] = "npshannon";
100 single["simpson"] = "simpson";
101 single["bootstrap"] = "bootstrap";
102 single["default"] = "default";
104 catch(exception& e) {
105 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
109 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
114 /********************************************************************/
115 void ValidCalculators::initialShared() {
117 shared["sharedChao"] = "sharedChao";
118 shared["sharedAce"] = "sharedAce";
119 shared["sharedJabund"] = "sharedJabund";
120 shared["sharedSorensonAbund"] = "sharedSorensonAbund";
121 shared["sharedJclass"] = "sharedJclass";
122 shared["sharedSorClass"] = "sharedSorClass";
123 shared["sharedJest"] = "sharedJest";
124 shared["sharedSorEst"] = "sharedSorEst";
125 shared["SharedThetaYC"] = "SharedThetaYC";
126 shared["SharedThetaN"] = "SharedThetaN";
127 shared["default"] = "default";
129 catch(exception& e) {
130 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
134 cout << "An unknown error has occurred in the ValidCalculator class function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
139 /********************************************************************/
140 void ValidCalculators::initialRarefaction() {
142 rarefaction["sobs"] = "sobs";
143 rarefaction["chao"] = "chao";
144 rarefaction["ace"] = "ace";
145 rarefaction["jack"] = "jack";
146 rarefaction["shannon"] = "shannon";
147 rarefaction["npshannon"] = "npshannon";
148 rarefaction["simpson"] = "simpson";
149 rarefaction["bootstrap"] = "bootstrap";
150 rarefaction["default"] = "default";
152 catch(exception& e) {
153 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
157 cout << "An unknown error has occurred in the ValidCalculator class function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
162 /********************************************************************/
164 void ValidCalculators::initialSummary() {
166 summary["sobs"] = "sobs";
167 summary["chao"] = "chao";
168 summary["ace"] = "ace";
169 summary["jack"] = "jack";
170 summary["shannon"] = "shannon";
171 summary["npshannon"] = "npshannon";
172 summary["simpson"] = "simpson";
173 summary["bootstrap"] = "bootstrap";
174 summary["default"] = "default";
176 catch(exception& e) {
177 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
181 cout << "An unknown error has occurred in the ValidCalculator class function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
186 /********************************************************************/
187 void ValidCalculators::initialSharedSummary() {
189 sharedsummary["sharedChao"] = "sharedChao";
190 sharedsummary["sharedAce"] = "sharedAce";
191 sharedsummary["sharedJabund"] = "sharedJabund";
192 sharedsummary["sharedSorensonAbund"] = "sharedSorensonAbund";
193 sharedsummary["sharedJclass"] = "sharedJclass";
194 sharedsummary["sharedSorClass"] = "sharedSorClass";
195 sharedsummary["sharedJest"] = "sharedJest";
196 sharedsummary["sharedSorEst"] = "sharedSorEst";
197 sharedsummary["SharedThetaYC"] = "SharedThetaYC";
198 sharedsummary["SharedThetaN"] = "SharedThetaN";
199 sharedsummary["default"] = "default";
201 catch(exception& e) {
202 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
206 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
212 /********************************************************************/
214 void ValidCalculators::initialSharedRarefact() {
216 sharedrarefaction["sharedobserved"] = "sharedobserved";
217 sharedrarefaction["default"] = "default";
219 catch(exception& e) {
220 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
224 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
229 /********************************************************************/