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();
26 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
30 cout << "An unknown error has occurred in the ValidCalculator class function ValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
35 /********************************************************************/
37 ValidCalculators::~ValidCalculators() {}
39 /********************************************************************/
41 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
43 //are you looking for a calculator for a single parameter
44 if (parameter == "single") {
46 if ((single.find(calculator)) != (single.end())) {
49 cout << calculator << " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ";
50 for (it = single.begin(); it != single.end(); it++) {
51 cout << it->first << ", ";
55 //are you looking for a calculator for a shared parameter
56 }else if (parameter == "shared") {
58 if ((shared.find(calculator)) != (shared.end())) {
61 cout << calculator << " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ";
62 for (it = shared.begin(); it != shared.end(); it++) {
63 cout << it->first << ", ";
67 //are you looking for a calculator for a rarefaction parameter
68 }else if (parameter == "rarefaction") {
70 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
73 cout << calculator << " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ";
74 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
75 cout << it->first << ", ";
79 //are you looking for a calculator for a summary parameter
80 }else if (parameter == "summary") {
82 if ((summary.find(calculator)) != (summary.end())) {
85 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
86 for (it = summary.begin(); it != summary.end(); it++) {
87 cout << it->first << ", ";
91 //are you looking for a calculator for a sharedsummary parameter
92 }else if (parameter == "sharedsummary") {
94 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
97 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
98 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
99 cout << it->first << ", ";
103 }else if (parameter == "sharedrarefaction") {
105 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
108 cout << calculator << " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ";
109 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
110 cout << it->first << ", ";
114 }else if (parameter == "vennsingle") {
116 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
119 cout << calculator << " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ";
120 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
121 cout << it->first << ", ";
125 }else if (parameter == "vennshared") {
127 if ((vennshared.find(calculator)) != (vennshared.end())) {
130 cout << calculator << " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ";
131 for (it = vennshared.begin(); it != vennshared.end(); it++) {
132 cout << it->first << ", ";
136 }else if (parameter == "treegroup") {
138 if ((treegroup.find(calculator)) != (treegroup.end())) {
141 cout << calculator << " is not a valid estimator for the tree.groups command in shared mode and will be disregarded. Valid estimators are ";
142 for (it = treegroup.begin(); it != treegroup.end(); it++) {
143 cout << it->first << ", ";
148 //not a valid parameter
149 }else { return false; }
152 catch(exception& e) {
153 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
157 cout << "An unknown error has occurred in the ValidCalculator class function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
162 /********************************************************************/
163 void ValidCalculators::initialSingle() {
165 single["sobs"] = "sobs";
166 single["chao"] = "chao";
167 single["ace"] = "ace";
168 single["jack"] = "jack";
169 single["shannon"] = "shannon";
170 single["npshannon"] = "npshannon";
171 single["simpson"] = "simpson";
172 single["bergerparker"] = "bergerparker";
173 single["bootstrap"] = "bootstrap";
174 single["geom"] = "geom";
175 single["logsd"] = "logsd";
176 single["qstat"] = "qstat";
177 single["bstick"] = "bstick";
178 single["nseqs"] = "nseqs";
179 single["default"] = "default";
181 catch(exception& e) {
182 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
186 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
191 /********************************************************************/
192 void ValidCalculators::initialShared() {
194 shared["sharedsobs"] = "sharedsobs";
195 shared["sharedchao"] = "sharedchao";
196 shared["sharedace"] = "sharedace";
197 shared["jabund"] = "jabund";
198 shared["sorensonabund"] = "sorensonabund";
199 shared["jclass"] = "jclass";
200 shared["sorclass"] = "sorclass";
201 shared["jest"] = "jest";
202 shared["sorest"] = "sorest";
203 shared["thetayc"] = "thetayc";
204 shared["thetan"] = "thetan";
205 shared["kstest"] = "kstest";
206 shared["bdiversity"] = "bdiversity";
207 shared["sharednseqs"] = "sharednseqs";
208 shared["ochiai"] = "ochiai";
209 shared["anderberg"] = "anderberg";
210 shared["kulczynski"] = "kulczynski";
211 shared["kulczynskicody"] = "kulczynskicody";
212 shared["lennon"] = "lennon";
213 shared["morisitahorn"] = "morisitahorn";
214 shared["braycurtis"] = "braycurtis";
215 shared["default"] = "default";
217 catch(exception& e) {
218 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
222 cout << "An unknown error has occurred in the ValidCalculator class function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
227 /********************************************************************/
228 void ValidCalculators::initialRarefaction() {
230 rarefaction["sobs"] = "sobs";
231 rarefaction["chao"] = "chao";
232 rarefaction["ace"] = "ace";
233 rarefaction["jack"] = "jack";
234 rarefaction["shannon"] = "shannon";
235 rarefaction["npshannon"] = "npshannon";
236 rarefaction["simpson"] = "simpson";
237 rarefaction["bootstrap"] = "bootstrap";
238 rarefaction["nseqs"] = "nseqs";
239 rarefaction["default"] = "default";
241 catch(exception& e) {
242 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
246 cout << "An unknown error has occurred in the ValidCalculator class function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
251 /********************************************************************/
253 void ValidCalculators::initialSummary() {
255 summary["sobs"] = "sobs";
256 summary["chao"] = "chao";
257 summary["ace"] = "ace";
258 summary["jack"] = "jack";
259 summary["shannon"] = "shannon";
260 summary["npshannon"] = "npshannon";
261 summary["simpson"] = "simpson";
262 summary["bergerparker"] = "bergerparker";
263 summary["geom"] = "geom";
264 summary["bootstrap"] = "bootstrap";
265 summary["logsd"] = "logsd";
266 summary["qstat"] = "qstat";
267 summary["bstick"] = "bstick";
268 summary["nseqs"] = "nseqs";
269 summary["default"] = "default";
271 catch(exception& e) {
272 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
276 cout << "An unknown error has occurred in the ValidCalculator class function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
281 /********************************************************************/
282 void ValidCalculators::initialSharedSummary() {
284 sharedsummary["sharedsobs"] = "sharedsobs";
285 sharedsummary["sharedchao"] = "sharedchao";
286 sharedsummary["sharedace"] = "sharedace";
287 sharedsummary["jabund"] = "jabund";
288 sharedsummary["sorensonabund"] = "sorensonabund";
289 sharedsummary["jclass"] = "jclass";
290 sharedsummary["sorclass"] = "sorclass";
291 sharedsummary["jest"] = "jest";
292 sharedsummary["sorest"] = "sorest";
293 sharedsummary["thetayc"] = "thetayc";
294 sharedsummary["thetan"] = "thetan";
295 sharedsummary["kstest"] = "kstest";
296 sharedsummary["bdiversity"] = "bdiversity";
297 sharedsummary["sharednseqs"] = "sharednseqs";
298 sharedsummary["ochiai"] = "ochiai";
299 sharedsummary["anderberg"] = "anderberg";
300 sharedsummary["kulczynski"] = "kulczynski";
301 sharedsummary["kulczynskicody"] = "kulczynskicody";
302 sharedsummary["lennon"] = "lennon";
303 sharedsummary["morisitahorn"] = "morisitahorn";
304 sharedsummary["braycurtis"] = "braycurtis";
305 sharedsummary["default"] = "default";
307 catch(exception& e) {
308 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
312 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
318 /********************************************************************/
320 void ValidCalculators::initialSharedRarefact() {
322 sharedrarefaction["sharedobserved"] = "sharedobserved";
323 sharedrarefaction["sharednseqs"] = "sharednseqs";
324 sharedrarefaction["default"] = "default";
326 catch(exception& e) {
327 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
331 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
337 /********************************************************************/
338 void ValidCalculators::initialVennSingle() {
340 vennsingle["sobs"] = "sobs";
341 vennsingle["chao"] = "chao";
342 vennsingle["ace"] = "ace";
343 vennsingle["jack"] = "jack";
344 vennsingle["default"] = "default";
346 catch(exception& e) {
347 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
351 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
356 /********************************************************************/
357 void ValidCalculators::initialVennShared() {
359 vennshared["sharedsobs"] = "sharedsobs";
360 vennshared["sharedchao"] = "sharedchao";
361 vennshared["sharedace"] = "sharedace";
362 vennshared["default"] = "default";
364 catch(exception& e) {
365 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
369 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
374 /********************************************************************/
375 void ValidCalculators::initialTreeGroups() {
377 treegroup["jabund"] = "jabund";
378 treegroup["sorensonabund"] = "sorensonabund";
379 treegroup["jclass"] = "jclass";
380 treegroup["sorclass"] = "sorclass";
381 treegroup["jest"] = "jest";
382 treegroup["sorest"] = "sorest";
383 treegroup["thetayc"] = "thetayc";
384 treegroup["thetan"] = "thetan";
385 treegroup["morisitahorn"] = "morisitahorn";
387 catch(exception& e) {
388 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialTreeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
392 cout << "An unknown error has occurred in the ValidCalculator class function initialTreeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
398 /********************************************************************/