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();
25 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
29 cout << "An unknown error has occurred in the ValidCalculator class function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
34 /********************************************************************/
36 ValidCalculators::~ValidCalculators() {}
38 /********************************************************************/
40 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
42 //are you looking for a calculator for a single parameter
43 if (parameter == "single") {
45 if ((single.find(calculator)) != (single.end())) {
48 cout << calculator << " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ";
49 for (it = single.begin(); it != single.end(); it++) {
50 cout << it->first << ", ";
54 //are you looking for a calculator for a shared parameter
55 }else if (parameter == "shared") {
57 if ((shared.find(calculator)) != (shared.end())) {
60 cout << calculator << " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ";
61 for (it = shared.begin(); it != shared.end(); it++) {
62 cout << it->first << ", ";
66 //are you looking for a calculator for a rarefaction parameter
67 }else if (parameter == "rarefaction") {
69 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
72 cout << calculator << " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ";
73 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
74 cout << it->first << ", ";
78 //are you looking for a calculator for a summary parameter
79 }else if (parameter == "summary") {
81 if ((summary.find(calculator)) != (summary.end())) {
84 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
85 for (it = summary.begin(); it != summary.end(); it++) {
86 cout << it->first << ", ";
90 //are you looking for a calculator for a sharedsummary parameter
91 }else if (parameter == "sharedsummary") {
93 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
96 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
97 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
98 cout << it->first << ", ";
102 }else if (parameter == "sharedrarefaction") {
104 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
107 cout << calculator << " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ";
108 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
109 cout << it->first << ", ";
113 }else if (parameter == "vennsingle") {
115 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
118 cout << calculator << " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ";
119 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
120 cout << it->first << ", ";
124 }else if (parameter == "vennshared") {
126 if ((vennshared.find(calculator)) != (vennshared.end())) {
129 cout << calculator << " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ";
130 for (it = vennshared.begin(); it != vennshared.end(); it++) {
131 cout << it->first << ", ";
135 //not a valid parameter
136 }else { return false; }
139 catch(exception& e) {
140 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
144 cout << "An unknown error has occurred in the ValidCalculator class function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
149 /********************************************************************/
150 void ValidCalculators::initialSingle() {
152 single["sobs"] = "sobs";
153 single["chao"] = "chao";
154 single["ace"] = "ace";
155 single["jack"] = "jack";
156 single["shannon"] = "shannon";
157 single["npshannon"] = "npshannon";
158 single["simpson"] = "simpson";
159 single["bergerparker"] = "bergerparker";
160 single["bootstrap"] = "bootstrap";
161 single["geom"] = "geom";
162 single["logsd"] = "logsd";
163 single["qstat"] = "qstat";
164 single["bstick"] = "bstick";
165 single["nseqs"] = "nseqs";
166 single["default"] = "default";
168 catch(exception& e) {
169 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
173 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
178 /********************************************************************/
179 void ValidCalculators::initialShared() {
181 shared["sharedsobs"] = "sharedsobs";
182 shared["sharedchao"] = "sharedchao";
183 shared["sharedace"] = "sharedace";
184 shared["sharedjabund"] = "sharedjabund";
185 shared["sharedsorensonabund"] = "sharedsorensonabund";
186 shared["sharedjclass"] = "sharedjclass";
187 shared["sharedsorclass"] = "sharedsorclass";
188 shared["sharedjest"] = "sharedjest";
189 shared["sharedsorest"] = "sharedsorest";
190 shared["sharedthetayc"] = "sharedthetayc";
191 shared["sharedthetan"] = "sharedthetan";
192 shared["sharedkstest"] = "sharedkstest";
193 shared["sharedbdiversity"] = "sharedbdiversity";
194 shared["sharednseqs"] = "sharednseqs";
195 shared["sharedochiai"] = "sharedochiai";
196 shared["sharedanderberg"] = "sharedanderberg";
197 shared["sharedkulczynski"] = "sharedkulczynski";
198 shared["sharedkulczynskicody"] = "sharedkulczynskicody";
199 shared["sharedlennon"] = "sharedlennon";
200 shared["sharedmorisitahorn"] = "sharedmorisitahorn";
201 shared["sharedbraycurtis"] = "sharedbraycurtis";
202 shared["default"] = "default";
204 catch(exception& e) {
205 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
209 cout << "An unknown error has occurred in the ValidCalculator class function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
214 /********************************************************************/
215 void ValidCalculators::initialRarefaction() {
217 rarefaction["sobs"] = "sobs";
218 rarefaction["chao"] = "chao";
219 rarefaction["ace"] = "ace";
220 rarefaction["jack"] = "jack";
221 rarefaction["shannon"] = "shannon";
222 rarefaction["npshannon"] = "npshannon";
223 rarefaction["simpson"] = "simpson";
224 rarefaction["bootstrap"] = "bootstrap";
225 rarefaction["nseqs"] = "nseqs";
226 rarefaction["default"] = "default";
228 catch(exception& e) {
229 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
233 cout << "An unknown error has occurred in the ValidCalculator class function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
238 /********************************************************************/
240 void ValidCalculators::initialSummary() {
242 summary["sobs"] = "sobs";
243 summary["chao"] = "chao";
244 summary["ace"] = "ace";
245 summary["jack"] = "jack";
246 summary["shannon"] = "shannon";
247 summary["npshannon"] = "npshannon";
248 summary["simpson"] = "simpson";
249 summary["bergerparker"] = "bergerparker";
250 summary["geom"] = "geom";
251 summary["bootstrap"] = "bootstrap";
252 summary["logsd"] = "logsd";
253 summary["qstat"] = "qstat";
254 summary["bstick"] = "bstick";
255 summary["nseqs"] = "nseqs";
256 summary["default"] = "default";
258 catch(exception& e) {
259 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
263 cout << "An unknown error has occurred in the ValidCalculator class function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
268 /********************************************************************/
269 void ValidCalculators::initialSharedSummary() {
271 sharedsummary["sharedsobs"] = "sharedsobs";
272 sharedsummary["sharedchao"] = "sharedchao";
273 sharedsummary["sharedace"] = "sharedace";
274 sharedsummary["sharedjabund"] = "sharedjabund";
275 sharedsummary["sharedsorensonabund"] = "sharedsorensonabund";
276 sharedsummary["sharedjclass"] = "sharedjclass";
277 sharedsummary["sharedsorclass"] = "sharedsorclass";
278 sharedsummary["sharedjest"] = "sharedjest";
279 sharedsummary["sharedsorest"] = "sharedsorest";
280 sharedsummary["sharedthetayc"] = "sharedthetayc";
281 sharedsummary["sharedthetan"] = "sharedthetan";
282 sharedsummary["sharedkstest"] = "sharedkstest";
283 sharedsummary["sharedbdiversity"] = "sharedbdiversity";
284 sharedsummary["sharednseqs"] = "sharednseqs";
285 sharedsummary["sharedochiai"] = "sharedochiai";
286 sharedsummary["sharedanderberg"] = "sharedanderberg";
287 sharedsummary["sharedkulczynski"] = "sharedkulczynski";
288 sharedsummary["sharedkulczynskicody"] = "sharedkulczynskicody";
289 sharedsummary["sharedlennon"] = "sharedlennon";
290 sharedsummary["sharedmorisitahorn"] = "sharedmorisitahorn";
291 sharedsummary["sharedbraycurtis"] = "sharedbraycurtis";
292 sharedsummary["default"] = "default";
294 catch(exception& e) {
295 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
299 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
305 /********************************************************************/
307 void ValidCalculators::initialSharedRarefact() {
309 sharedrarefaction["sharedobserved"] = "sharedobserved";
310 sharedrarefaction["sharednseqs"] = "sharednseqs";
311 sharedrarefaction["default"] = "default";
313 catch(exception& e) {
314 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
318 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
324 /********************************************************************/
325 void ValidCalculators::initialVennSingle() {
327 vennsingle["sobs"] = "sobs";
328 vennsingle["chao"] = "chao";
329 vennsingle["ace"] = "ace";
330 vennsingle["jack"] = "jack";
331 vennsingle["default"] = "default";
333 catch(exception& e) {
334 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
338 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
343 /********************************************************************/
344 void ValidCalculators::initialVennShared() {
346 vennshared["sharedsobs"] = "sharedsobs";
347 vennshared["sharedchao"] = "sharedchao";
348 vennshared["sharedace"] = "sharedace";
349 vennshared["default"] = "default";
351 catch(exception& e) {
352 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
356 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
361 /********************************************************************/