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["sharedjabund"] = "sharedjabund";
198 shared["sharedsorensonabund"] = "sharedsorensonabund";
199 shared["sharedjclass"] = "sharedjclass";
200 shared["sharedsorclass"] = "sharedsorclass";
201 shared["sharedjest"] = "sharedjest";
202 shared["sharedsorest"] = "sharedsorest";
203 shared["sharedthetayc"] = "sharedthetayc";
204 shared["sharedthetan"] = "sharedthetan";
205 shared["sharedkstest"] = "sharedkstest";
206 shared["sharedbdiversity"] = "sharedbdiversity";
207 shared["sharednseqs"] = "sharednseqs";
208 shared["sharedochiai"] = "sharedochiai";
209 shared["sharedanderberg"] = "sharedanderberg";
210 shared["sharedkulczynski"] = "sharedkulczynski";
211 shared["sharedkulczynskicody"] = "sharedkulczynskicody";
212 shared["sharedlennon"] = "sharedlennon";
213 shared["sharedmorisitahorn"] = "sharedmorisitahorn";
214 shared["sharedbraycurtis"] = "sharedbraycurtis";
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["sharedjabund"] = "sharedjabund";
288 sharedsummary["sharedsorensonabund"] = "sharedsorensonabund";
289 sharedsummary["sharedjclass"] = "sharedjclass";
290 sharedsummary["sharedsorclass"] = "sharedsorclass";
291 sharedsummary["sharedjest"] = "sharedjest";
292 sharedsummary["sharedsorest"] = "sharedsorest";
293 sharedsummary["sharedthetayc"] = "sharedthetayc";
294 sharedsummary["sharedthetan"] = "sharedthetan";
295 sharedsummary["sharedkstest"] = "sharedkstest";
296 sharedsummary["sharedbdiversity"] = "sharedbdiversity";
297 sharedsummary["sharednseqs"] = "sharednseqs";
298 sharedsummary["sharedochiai"] = "sharedochiai";
299 sharedsummary["sharedanderberg"] = "sharedanderberg";
300 sharedsummary["sharedkulczynski"] = "sharedkulczynski";
301 sharedsummary["sharedkulczynskicody"] = "sharedkulczynskicody";
302 sharedsummary["sharedlennon"] = "sharedlennon";
303 sharedsummary["sharedmorisitahorn"] = "sharedmorisitahorn";
304 sharedsummary["sharedbraycurtis"] = "sharedbraycurtis";
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["sharedjabund"] = "sharedjabund";
378 treegroup["sharedsorensonabund"] = "sharedsorensonabund";
379 treegroup["sharedjclass"] = "sharedjclass";
380 treegroup["sharedsorclass"] = "sharedsorclass";
381 treegroup["sharedjest"] = "sharedjest";
382 treegroup["sharedsorest"] = "sharedsorest";
383 treegroup["sharedthetayc"] = "sharedthetayc";
384 treegroup["sharedthetan"] = "sharedthetan";
385 treegroup["sharedmorisitahorn"] = "sharedmorisitahorn";
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 /********************************************************************/