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["bootstrap"] = "bootstrap";
137 single["default"] = "default";
138 single["nseqs"] = "nseqs";
140 catch(exception& e) {
141 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
145 cout << "An unknown error has occurred in the ValidCalculator class function initialSingle. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
150 /********************************************************************/
151 void ValidCalculators::initialShared() {
153 shared["sharedsobs"] = "sharedsobs";
154 shared["sharedchao"] = "sharedchao";
155 shared["sharedace"] = "sharedace";
156 shared["sharedjabund"] = "sharedjabund";
157 shared["sharedsorensonabund"] = "sharedsorensonabund";
158 shared["sharedjclass"] = "sharedjclass";
159 shared["sharedsorclass"] = "sharedsorclass";
160 shared["sharedjest"] = "sharedjest";
161 shared["sharedsorest"] = "sharedsorest";
162 shared["sharedthetayc"] = "sharedthetayc";
163 shared["sharedthetan"] = "sharedthetan";
164 shared["sharednseqs"] = "sharednseqs";
165 shared["sharedochiai"] = "sharedochiai";
166 shared["sharedanderberg"] = "sharedanderberg";
167 shared["default"] = "default";
169 catch(exception& e) {
170 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
174 cout << "An unknown error has occurred in the ValidCalculator class function initialShared. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
179 /********************************************************************/
180 void ValidCalculators::initialRarefaction() {
182 rarefaction["sobs"] = "sobs";
183 rarefaction["chao"] = "chao";
184 rarefaction["ace"] = "ace";
185 rarefaction["jack"] = "jack";
186 rarefaction["shannon"] = "shannon";
187 rarefaction["npshannon"] = "npshannon";
188 rarefaction["simpson"] = "simpson";
189 rarefaction["bootstrap"] = "bootstrap";
190 rarefaction["nseqs"] = "nseqs";
191 rarefaction["default"] = "default";
193 catch(exception& e) {
194 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
198 cout << "An unknown error has occurred in the ValidCalculator class function initialRarefaction. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
203 /********************************************************************/
205 void ValidCalculators::initialSummary() {
207 summary["sobs"] = "sobs";
208 summary["chao"] = "chao";
209 summary["ace"] = "ace";
210 summary["jack"] = "jack";
211 summary["shannon"] = "shannon";
212 summary["npshannon"] = "npshannon";
213 summary["simpson"] = "simpson";
214 summary["bootstrap"] = "bootstrap";
215 summary["nseqs"] = "nseqs";
216 summary["default"] = "default";
218 catch(exception& e) {
219 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
223 cout << "An unknown error has occurred in the ValidCalculator class function initialSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
228 /********************************************************************/
229 void ValidCalculators::initialSharedSummary() {
231 sharedsummary["sharedsobs"] = "sharedsobs";
232 sharedsummary["sharedchao"] = "sharedchao";
233 sharedsummary["sharedace"] = "sharedace";
234 sharedsummary["sharedjabund"] = "sharedjabund";
235 sharedsummary["sharedsorensonabund"] = "sharedsorensonabund";
236 sharedsummary["sharedjclass"] = "sharedjclass";
237 sharedsummary["sharedsorclass"] = "sharedsorclass";
238 sharedsummary["sharedjest"] = "sharedjest";
239 sharedsummary["sharedsorest"] = "sharedsorest";
240 sharedsummary["sharedthetayc"] = "sharedthetayc";
241 sharedsummary["sharedthetan"] = "sharedthetan";
242 sharedsummary["sharednseqs"] = "sharednseqs";
243 sharedsummary["sharedochiai"] = "sharedochiai";
244 sharedsummary["sharedanderberg"] = "sharedanderberg";
245 sharedsummary["default"] = "default";
247 catch(exception& e) {
248 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
252 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedSummary. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
258 /********************************************************************/
260 void ValidCalculators::initialSharedRarefact() {
262 sharedrarefaction["sharedobserved"] = "sharedobserved";
263 sharedrarefaction["sharednseqs"] = "sharednseqs";
264 sharedrarefaction["default"] = "default";
266 catch(exception& e) {
267 cout << "Standard Error: " << e.what() << " has occurred in the ValidCalculator class Function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
271 cout << "An unknown error has occurred in the ValidCalculator class function initialSharedRarefact. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
276 /********************************************************************/