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())) {
46 cout << calculator << " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ";
47 for (it = single.begin(); it != single.end(); it++) {
48 cout << it->first << ", ";
52 //are you looking for a calculator for a shared parameter
53 }else if (parameter == "shared") {
55 if ((shared.find(calculator)) != (shared.end())) {
58 cout << calculator << " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ";
59 for (it = shared.begin(); it != shared.end(); it++) {
60 cout << it->first << ", ";
64 //are you looking for a calculator for a rarefaction parameter
65 }else if (parameter == "rarefaction") {
67 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
70 cout << calculator << " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ";
71 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
72 cout << it->first << ", ";
76 //are you looking for a calculator for a summary parameter
77 }else if (parameter == "summary") {
79 if ((summary.find(calculator)) != (summary.end())) {
82 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
83 for (it = summary.begin(); it != summary.end(); it++) {
84 cout << it->first << ", ";
88 //are you looking for a calculator for a sharedsummary parameter
89 }else if (parameter == "sharedsummary") {
91 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
94 cout << calculator << " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ";
95 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
96 cout << it->first << ", ";
100 }else if (parameter == "sharedrarefaction") {
102 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
105 cout << calculator << " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ";
106 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
107 cout << it->first << ", ";
111 //not a valid paramter
112 }else { return false; }
115 catch(exception& e) {
116 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
120 cout << "An unknown error has occurred in the ValidCalculator class function isValidCalculator. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
125 /********************************************************************/
126 void ValidCalculators::initialSingle() {
129 single["sobs"] = "sobs";
130 single["chao"] = "chao";
131 single["ace"] = "ace";
132 single["jack"] = "jack";
133 single["shannon"] = "shannon";
134 single["npshannon"] = "npshannon";
135 single["simpson"] = "simpson";
136 single["bergerparker"] = "bergerparker";
137 single["bootstrap"] = "bootstrap";
138 single["geom"] = "geom";
139 single["logsd"] = "logsd";
140 single["qstat"] = "qstat";
141 single["bstick"] = "bstick";
142 single["nseqs"] = "nseqs";
143 single["default"] = "default";
146 catch(exception& e) {
147 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
151 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
156 /********************************************************************/
157 void ValidCalculators::initialShared() {
159 shared["sharedsobs"] = "sharedsobs";
160 shared["sharedchao"] = "sharedchao";
161 shared["sharedace"] = "sharedace";
162 shared["sharedjabund"] = "sharedjabund";
163 shared["sharedsorensonabund"] = "sharedsorensonabund";
164 shared["sharedjclass"] = "sharedjclass";
165 shared["sharedsorclass"] = "sharedsorclass";
166 shared["sharedjest"] = "sharedjest";
167 shared["sharedsorest"] = "sharedsorest";
168 shared["sharedthetayc"] = "sharedthetayc";
169 shared["sharedthetan"] = "sharedthetan";
170 shared["sharedkstest"] = "sharedkstest";
171 shared["sharedbdiversity"] = "sharedbdiversity";
172 shared["sharednseqs"] = "sharednseqs";
173 shared["sharedochiai"] = "sharedochiai";
174 shared["sharedanderberg"] = "sharedanderberg";
175 shared["sharedkulczynski"] = "sharedkulczynski";
176 shared["sharedkulczynskicody"] = "sharedkulczynskicody";
177 shared["sharedlennon"] = "sharedlennon";
178 shared["sharedmorisitahorn"] = "sharedmorisitahorn";
179 shared["sharedbraycurtis"] = "sharedbraycurtis";
180 shared["default"] = "default";
182 catch(exception& e) {
183 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
187 cout << "An unknown error has occurred in the ValidCalculator class function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
192 /********************************************************************/
193 void ValidCalculators::initialRarefaction() {
195 rarefaction["sobs"] = "sobs";
196 rarefaction["chao"] = "chao";
197 rarefaction["ace"] = "ace";
198 rarefaction["jack"] = "jack";
199 rarefaction["shannon"] = "shannon";
200 rarefaction["npshannon"] = "npshannon";
201 rarefaction["simpson"] = "simpson";
202 rarefaction["bootstrap"] = "bootstrap";
203 rarefaction["nseqs"] = "nseqs";
204 rarefaction["default"] = "default";
206 catch(exception& e) {
207 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
211 cout << "An unknown error has occurred in the ValidCalculator class function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
216 /********************************************************************/
218 void ValidCalculators::initialSummary() {
220 summary["sobs"] = "sobs";
221 summary["chao"] = "chao";
222 summary["ace"] = "ace";
223 summary["jack"] = "jack";
224 summary["shannon"] = "shannon";
225 summary["npshannon"] = "npshannon";
226 summary["simpson"] = "simpson";
227 summary["bergerparker"] = "bergerparker";
228 summary["geom"] = "geom";
229 summary["bootstrap"] = "bootstrap";
230 summary["logsd"] = "logsd";
231 summary["qstat"] = "qstat";
232 summary["bstick"] = "bstick";
233 summary["nseqs"] = "nseqs";
234 summary["default"] = "default";
236 catch(exception& e) {
237 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
241 cout << "An unknown error has occurred in the ValidCalculator class function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
246 /********************************************************************/
247 void ValidCalculators::initialSharedSummary() {
249 sharedsummary["sharedsobs"] = "sharedsobs";
250 sharedsummary["sharedchao"] = "sharedchao";
251 sharedsummary["sharedace"] = "sharedace";
252 sharedsummary["sharedjabund"] = "sharedjabund";
253 sharedsummary["sharedsorensonabund"] = "sharedsorensonabund";
254 sharedsummary["sharedjclass"] = "sharedjclass";
255 sharedsummary["sharedsorclass"] = "sharedsorclass";
256 sharedsummary["sharedjest"] = "sharedjest";
257 sharedsummary["sharedsorest"] = "sharedsorest";
258 sharedsummary["sharedthetayc"] = "sharedthetayc";
259 sharedsummary["sharedthetan"] = "sharedthetan";
260 sharedsummary["sharedkstest"] = "sharedkstest";
261 sharedsummary["sharedbdiversity"] = "sharedbdiversity";
262 sharedsummary["sharednseqs"] = "sharednseqs";
263 sharedsummary["sharedochiai"] = "sharedochiai";
264 sharedsummary["sharedanderberg"] = "sharedanderberg";
265 sharedsummary["sharedkulczynski"] = "sharedkulczynski";
266 sharedsummary["sharedkulczynskicody"] = "sharedkulczynskicody";
267 sharedsummary["sharedlennon"] = "sharedlennon";
268 sharedsummary["sharedmorisitahorn"] = "sharedmorisitahorn";
269 sharedsummary["sharedbraycurtis"] = "sharedbraycurtis";
270 sharedsummary["default"] = "default";
272 catch(exception& e) {
273 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
277 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
283 /********************************************************************/
285 void ValidCalculators::initialSharedRarefact() {
287 sharedrarefaction["sharedobserved"] = "sharedobserved";
288 sharedrarefaction["sharednseqs"] = "sharednseqs";
289 sharedrarefaction["default"] = "default";
291 catch(exception& e) {
292 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
296 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
301 /********************************************************************/