5 * Created by Sarah Westcott on 1/5/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "validcalculator.h"
15 #include "bootstrap.h"
17 #include "simpsoneven.h"
18 #include "invsimpson.h"
19 #include "npshannon.h"
21 #include "smithwilson.h"
23 #include "shannoneven.h"
24 #include "jackknife.h"
28 #include "bergerparker.h"
30 #include "goodscoverage.h"
36 #include "sharedsobscollectsummary.h"
37 #include "sharedchao1.h"
38 #include "sharedace.h"
39 #include "sharedjabund.h"
40 #include "sharedsorabund.h"
41 #include "sharedjclass.h"
42 #include "sharedsorclass.h"
43 #include "sharedjest.h"
44 #include "sharedsorest.h"
45 #include "sharedthetayc.h"
46 #include "sharedthetan.h"
47 #include "sharedkstest.h"
48 #include "whittaker.h"
49 #include "sharednseqs.h"
50 #include "sharedochiai.h"
51 #include "sharedanderbergs.h"
52 #include "sharedkulczynski.h"
53 #include "sharedkulczynskicody.h"
54 #include "sharedlennon.h"
55 #include "sharedmorisitahorn.h"
56 #include "sharedbraycurtis.h"
57 #include "sharedjackknife.h"
58 #include "whittaker.h"
61 #include "structeuclidean.h"
62 #include "structchord.h"
63 #include "hellinger.h"
64 #include "manhattan.h"
65 #include "structpearson.h"
68 #include "structkulczynski.h"
69 #include "structchi2.h"
70 #include "speciesprofile.h"
75 #include "memeuclidean.h"
76 #include "mempearson.h"
77 #include "sharedsobs.h"
78 #include "sharednseqs.h"
79 #include "sharedjsd.h"
80 #include "sharedrjsd.h"
83 /********************************************************************/
84 ValidCalculators::ValidCalculators() {
86 m = MothurOut::getInstance();
91 initialSharedRarefact();
93 initialSharedSummary();
102 for(it = single.begin(); it != single.end(); it++) { allCalcs.insert(it->first); }
103 for(it = shared.begin(); it != shared.end(); it++) { allCalcs.insert(it->first); }
104 for(it = rarefaction.begin(); it != rarefaction.end(); it++) { allCalcs.insert(it->first); }
105 for(it = summary.begin(); it != summary.end(); it++) { allCalcs.insert(it->first); }
106 for(it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) { allCalcs.insert(it->first); }
107 for(it = sharedsummary.begin(); it != sharedsummary.end(); it++) { allCalcs.insert(it->first); }
108 for(it = vennsingle.begin(); it != vennsingle.end(); it++) { allCalcs.insert(it->first); }
109 for(it = vennshared.begin(); it != vennshared.end(); it++) { allCalcs.insert(it->first); }
110 for(it = treegroup.begin(); it != treegroup.end(); it++) { allCalcs.insert(it->first); }
111 for(it = matrix.begin(); it != matrix.end(); it++) { allCalcs.insert(it->first); }
112 for(it = heat.begin(); it != heat.end(); it++) { allCalcs.insert(it->first); }
113 for(it = boot.begin(); it != boot.end(); it++) { allCalcs.insert(it->first); }
114 for(it = distance.begin(); it != distance.end(); it++) { allCalcs.insert(it->first); }
117 catch(exception& e) {
118 m->errorOut(e, "ValidCalculator", "ValidCalculator");
122 /********************************************************************/
123 ValidCalculators::~ValidCalculators() {}
124 /********************************************************************/
125 void ValidCalculators::printCitations(vector<string> Estimators) {
128 for (int i = 0; i < Estimators.size(); i++) {
129 //is this citation, do nothing
130 if ((Estimators[i] == "citation") || (Estimators[i] == "default") || (Estimators[i] == "eachgap") || (Estimators[i] == "nogaps") || (Estimators[i] == "onegap")) {}
131 //is this a valid calculator
132 else if (allCalcs.count(Estimators[i]) != 0) {
133 if (Estimators[i] == "sobs") { Calculator* temp = new Sobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
134 }else if (Estimators[i] == "chao") { Calculator* temp = new Chao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
135 }else if (Estimators[i] == "nseqs") { Calculator* temp = new NSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
136 }else if (Estimators[i] == "coverage") { Calculator* temp = new Coverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
137 }else if (Estimators[i] == "ace") { Calculator* temp = new Ace(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
139 }else if (Estimators[i] == "jack") { Calculator* temp = new Jackknife(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
140 }else if (Estimators[i] == "shannon") { Calculator* temp = new Shannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
141 }else if (Estimators[i] == "shannoneven") { Calculator* temp = new ShannonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
142 }else if (Estimators[i] == "npshannon") { Calculator* temp = new NPShannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
143 }else if (Estimators[i] == "heip") { Calculator* temp = new Heip(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
145 }else if (Estimators[i] == "smithwilson") { Calculator* temp = new SmithWilson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
146 }else if (Estimators[i] == "simpson") { Calculator* temp = new Simpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
147 }else if (Estimators[i] == "simpsoneven") { Calculator* temp = new SimpsonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
148 }else if (Estimators[i] == "invsimpson") { Calculator* temp = new InvSimpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
149 }else if (Estimators[i] == "bootstrap") { Calculator* temp = new Bootstrap(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
151 }else if (Estimators[i] == "geometric") { Calculator* temp = new Geom(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
152 }else if (Estimators[i] == "qstat") { Calculator* temp = new QStat(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
153 }else if (Estimators[i] == "logseries") { Calculator* temp = new LogSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
154 }else if (Estimators[i] == "bergerparker") { Calculator* temp = new BergerParker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
155 }else if (Estimators[i] == "bstick") { Calculator* temp = new BStick(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
157 }else if (Estimators[i] == "goodscoverage") { Calculator* temp = new GoodsCoverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
158 }else if (Estimators[i] == "efron") { Calculator* temp = new Efron(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
159 }else if (Estimators[i] == "boneh") { Calculator* temp = new Boneh(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
160 }else if (Estimators[i] == "solow") { Calculator* temp = new Solow(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
161 }else if (Estimators[i] == "shen") { Calculator* temp = new Shen(10, 10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
163 }else if (Estimators[i] == "sharedchao") { Calculator* temp = new SharedChao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
164 }else if (Estimators[i] == "sharedsobs") { Calculator* temp = new SharedSobsCS(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
165 }else if (Estimators[i] == "sharedace") { Calculator* temp = new SharedAce(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
166 }else if (Estimators[i] == "jabund") { Calculator* temp = new JAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
167 }else if (Estimators[i] == "sorabund") { Calculator* temp = new SorAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
169 }else if (Estimators[i] == "jclass") { Calculator* temp = new Jclass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
170 }else if (Estimators[i] == "sorclass") { Calculator* temp = new SorClass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
171 }else if (Estimators[i] == "jest") { Calculator* temp = new Jest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
172 }else if (Estimators[i] == "sorest") { Calculator* temp = new SorEst(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
173 }else if (Estimators[i] == "thetayc") { Calculator* temp = new ThetaYC(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
175 }else if (Estimators[i] == "thetan") { Calculator* temp = new ThetaN(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
176 }else if (Estimators[i] == "kstest") { Calculator* temp = new KSTest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
177 }else if (Estimators[i] == "whittaker") { Calculator* temp = new Whittaker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
178 }else if (Estimators[i] == "sharednseqs") { Calculator* temp = new SharedNSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
179 }else if (Estimators[i] == "ochiai") { Calculator* temp = new Ochiai(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
181 }else if (Estimators[i] == "anderberg") { Calculator* temp = new Anderberg(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
182 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
183 }else if (Estimators[i] == "kulczynskicody") { Calculator* temp = new KulczynskiCody(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
184 }else if (Estimators[i] == "lennon") { Calculator* temp = new Lennon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
185 }else if (Estimators[i] == "morisitahorn") { Calculator* temp = new MorHorn(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
187 }else if (Estimators[i] == "braycurtis") { Calculator* temp = new BrayCurtis(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
188 }else if (Estimators[i] == "odum") { Calculator* temp = new Odum(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
189 }else if (Estimators[i] == "canberra") { Calculator* temp = new Canberra(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
190 }else if (Estimators[i] == "structeuclidean") { Calculator* temp = new StructEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
191 }else if (Estimators[i] == "structchord") { Calculator* temp = new StructChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
193 }else if (Estimators[i] == "hellinger") { Calculator* temp = new Hellinger(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
194 }else if (Estimators[i] == "manhattan") { Calculator* temp = new Manhattan(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
195 }else if (Estimators[i] == "structpearson") { Calculator* temp = new StructPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
196 }else if (Estimators[i] == "soergel") { Calculator* temp = new Soergel(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
197 }else if (Estimators[i] == "spearman") { Calculator* temp = new Spearman(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
199 }else if (Estimators[i] == "structkulczynski") { Calculator* temp = new StructKulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
200 }else if (Estimators[i] == "speciesprofile") { Calculator* temp = new SpeciesProfile(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
201 }else if (Estimators[i] == "hamming") { Calculator* temp = new Hamming(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
202 }else if (Estimators[i] == "structchi2") { Calculator* temp = new StructChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
203 }else if (Estimators[i] == "gower") { Calculator* temp = new Gower(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
205 }else if (Estimators[i] == "memchi2") { Calculator* temp = new MemChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
206 }else if (Estimators[i] == "memchord") { Calculator* temp = new MemChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
207 }else if (Estimators[i] == "memeuclidean") { Calculator* temp = new MemEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
208 }else if (Estimators[i] == "mempearson") { Calculator* temp = new MemPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
209 }else if (Estimators[i] == "sharedobserved") { Calculator* temp = new SharedSobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
210 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
211 }else if (Estimators[i] == "jsd") { Calculator* temp = new JSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
212 }else if (Estimators[i] == "rjsd") { Calculator* temp = new RJSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
213 }else { m->mothurOut("[ERROR]: Missing else if for " + Estimators[i] + " in printCitations."); m->mothurOutEndLine(); }
214 }else { m->mothurOut(Estimators[i] + " is not a valid calculator, no citation will be given."); m->mothurOutEndLine(); }
218 catch(exception& e) {
219 m->errorOut(e, "ValidCalculator", "printCitations");
223 /********************************************************************/
225 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
227 //are you looking for a calculator for a single parameter
228 if (parameter == "single") {
230 if ((single.find(calculator)) != (single.end())) {
233 m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
234 for (it = single.begin(); it != single.end(); it++) {
235 m->mothurOut(it->first + ", ");
237 m->mothurOutEndLine();
239 //are you looking for a calculator for a shared parameter
240 }else if (parameter == "shared") {
242 if ((shared.find(calculator)) != (shared.end())) {
245 m->mothurOut(calculator + " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ");
246 for (it = shared.begin(); it != shared.end(); it++) {
247 m->mothurOut(it->first + ", ");
249 m->mothurOutEndLine();
251 //are you looking for a calculator for a rarefaction parameter
252 }else if (parameter == "rarefaction") {
254 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
257 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
258 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
259 m->mothurOut(it->first + ", ");
261 m->mothurOutEndLine();
263 //are you looking for a calculator for a summary parameter
264 }else if (parameter == "summary") {
266 if ((summary.find(calculator)) != (summary.end())) {
269 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
270 for (it = summary.begin(); it != summary.end(); it++) {
271 m->mothurOut(it->first + ", ");
273 m->mothurOutEndLine();
275 //are you looking for a calculator for a sharedsummary parameter
276 }else if (parameter == "sharedsummary") {
278 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
281 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
282 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
283 m->mothurOut(it->first + ", ");
285 m->mothurOutEndLine();
287 }else if (parameter == "sharedrarefaction") {
289 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
292 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
293 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
294 m->mothurOut(it->first + ", ");
296 m->mothurOutEndLine();
298 }else if (parameter == "vennsingle") {
300 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
303 m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
304 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
305 m->mothurOut(it->first + ", ");
307 m->mothurOutEndLine();
309 }else if (parameter == "vennshared") {
311 if ((vennshared.find(calculator)) != (vennshared.end())) {
314 m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
315 for (it = vennshared.begin(); it != vennshared.end(); it++) {
316 m->mothurOut(it->first + ", ");
318 m->mothurOutEndLine();
320 }else if (parameter == "treegroup") {
322 if ((treegroup.find(calculator)) != (treegroup.end())) {
325 m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
326 for (it = treegroup.begin(); it != treegroup.end(); it++) {
327 m->mothurOut(it->first + ", ");
329 m->mothurOutEndLine();
331 }else if (parameter == "matrix") {
333 if ((matrix.find(calculator)) != (matrix.end())) {
336 m->mothurOut(calculator + " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
337 for (it = matrix.begin(); it != matrix.end(); it++) {
338 m->mothurOut(it->first + ", ");
340 m->mothurOutEndLine();
342 }else if (parameter == "heat") {
344 if ((heat.find(calculator)) != (heat.end())) {
347 m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
348 for (it = heat.begin(); it != heat.end(); it++) {
349 m->mothurOut(it->first + ", ");
351 m->mothurOutEndLine();
353 }else if (parameter == "boot") {
355 if ((boot.find(calculator)) != (boot.end())) {
358 m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
359 for (it = boot.begin(); it != boot.end(); it++) {
360 m->mothurOut(it->first + ", ");
362 m->mothurOutEndLine();
364 }else if (parameter == "distance") {
366 if ((distance.find(calculator)) != (distance.end())) {
369 m->mothurOut(calculator + " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
370 for (it = distance.begin(); it != distance.end(); it++) {
371 m->mothurOut(it->first + ", ");
373 m->mothurOutEndLine();
375 //not a valid parameter
376 }else { return false; }
379 catch(exception& e) {
380 m->errorOut(e, "ValidCalculator", "isValidCalculator");
385 /********************************************************************/
386 void ValidCalculators::initialSingle() {
388 single["sobs"] = "sobs";
389 single["chao"] = "chao";
390 single["ace"] = "ace";
391 single["jack"] = "jack";
392 single["shannon"] = "shannon";
393 single["npshannon"] = "npshannon";
394 single["shannoneven"] = "shannoneven";
395 single["smithwilson"] = "smithwilson";
396 single["heip"] = "heip";
397 single["simpson"] = "simpson";
398 single["simpsoneven"] = "simpsoneven";
399 single["invsimpson"] = "invsimpson";
400 single["bergerparker"] = "bergerparker";
401 single["bootstrap"] = "bootstrap";
402 single["geometric"] = "geometric";
403 single["logseries"] = "logseries";
404 single["qstat"] = "qstat";
405 single["bstick"] = "bstick";
406 single["goodscoverage"] = "goodscoverage";
407 single["nseqs"] = "nseqs";
408 single["coverage"] = "coverage";
409 single["efron"] = "efron";
410 single["boneh"] = "boneh";
411 single["solow"] = "solow";
412 single["shen"] = "shen";
413 single["default"] = "default";
415 catch(exception& e) {
416 m->errorOut(e, "ValidCalculator", "initialSingle");
421 /********************************************************************/
422 void ValidCalculators::initialShared() {
424 shared["sharedsobs"] = "sharedsobs";
425 shared["sharedchao"] = "sharedchao";
426 shared["sharedace"] = "sharedace";
427 shared["jabund"] = "jabund";
428 shared["sorabund"] = "sorabund";
429 shared["jclass"] = "jclass";
430 shared["sorclass"] = "sorclass";
431 shared["jest"] = "jest";
432 shared["sorest"] = "sorest";
433 shared["thetayc"] = "thetayc";
434 shared["thetan"] = "thetan";
435 shared["kstest"] = "kstest";
436 shared["whittaker"] = "whittaker";
437 shared["sharednseqs"] = "sharednseqs";
438 shared["ochiai"] = "ochiai";
439 shared["anderberg"] = "anderberg";
440 shared["kulczynski"] = "kulczynski";
441 shared["kulczynskicody"] = "kulczynskicody";
442 shared["lennon"] = "lennon";
443 shared["morisitahorn"] = "morisitahorn";
444 shared["braycurtis"] = "braycurtis";
445 shared["odum"] = "odum";
446 shared["canberra"] = "canberra";
447 shared["structeuclidean"] = "structeuclidean";
448 shared["structchord"] = "structchord";
449 shared["hellinger"] = "hellinger";
450 shared["manhattan"] = "manhattan";
451 shared["structpearson"] = "structpearson";
452 shared["soergel"] = "soergel";
453 shared["spearman"] = "spearman";
454 shared["structkulczynski"] = "structkulczynski";
455 shared["structchi2"] = "structchi2";
456 shared["speciesprofile"] = "speciesprofile";
457 shared["hamming"] = "hamming";
458 shared["gower"] = "gower";
459 shared["memchi2"] = "memchi2";
460 shared["memchord"] = "memchord";
461 shared["memeuclidean"] = "memeuclidean";
462 shared["mempearson"] = "mempearson";
463 shared["jsd"] = "jsd";
464 shared["rjsd"] = "rjsd";
465 shared["default"] = "default";
467 catch(exception& e) {
468 m->errorOut(e, "ValidCalculator", "initialShared");
473 /********************************************************************/
474 void ValidCalculators::initialRarefaction() {
476 rarefaction["sobs"] = "sobs";
477 rarefaction["chao"] = "chao";
478 rarefaction["ace"] = "ace";
479 rarefaction["jack"] = "jack";
480 rarefaction["shannon"] = "shannon";
481 rarefaction["smithwilson"] = "smithwilson";
482 rarefaction["heip"] = "heip";
483 rarefaction["npshannon"] = "npshannon";
484 rarefaction["shannoneven"] = "shannoneven";
485 rarefaction["simpson"] = "simpson";
486 rarefaction["invsimpson"] = "invsimpson";
487 rarefaction["simpsoneven"] = "simpsoneven";
488 rarefaction["bootstrap"] = "bootstrap";
489 rarefaction["nseqs"] = "nseqs";
490 rarefaction["coverage"] = "coverage";
491 rarefaction["default"] = "default";
493 catch(exception& e) {
494 m->errorOut(e, "ValidCalculator", "initialRarefaction");
499 /********************************************************************/
501 void ValidCalculators::initialSummary() {
503 summary["sobs"] = "sobs";
504 summary["chao"] = "chao";
505 summary["ace"] = "ace";
506 summary["jack"] = "jack";
507 summary["shannon"] = "shannon";
508 summary["heip"] = "heip";
509 summary["shannoneven"] = "shannoneven";
510 summary["smithwilson"] = "smithwilson";
511 summary["invsimpson"] = "invsimpson";
512 summary["npshannon"] = "npshannon";
513 summary["simpson"] = "simpson";
514 summary["simpsoneven"] = "simpsoneven";
515 summary["bergerparker"] = "bergerparker";
516 summary["geometric"] = "geometric";
517 summary["bootstrap"] = "bootstrap";
518 summary["logseries"] = "logseries";
519 summary["qstat"] = "qstat";
520 summary["bstick"] = "bstick";
521 summary["nseqs"] = "nseqs";
522 summary["goodscoverage"]= "goodscoverage";
523 summary["coverage"] = "coverage";
524 summary["efron"] = "efron";
525 summary["boneh"] = "boneh";
526 summary["solow"] = "solow";
527 summary["shen"] = "shen";
528 summary["default"] = "default";
530 catch(exception& e) {
531 m->errorOut(e, "ValidCalculator", "initialSummary");
536 /********************************************************************/
537 void ValidCalculators::initialSharedSummary() {
539 sharedsummary["sharedsobs"] = "sharedsobs";
540 sharedsummary["sharedchao"] = "sharedchao";
541 sharedsummary["sharedace"] = "sharedace";
542 sharedsummary["jabund"] = "jabund";
543 sharedsummary["sorabund"] = "sorabund";
544 sharedsummary["jclass"] = "jclass";
545 sharedsummary["sorclass"] = "sorclass";
546 sharedsummary["jest"] = "jest";
547 sharedsummary["sorest"] = "sorest";
548 sharedsummary["thetayc"] = "thetayc";
549 sharedsummary["thetan"] = "thetan";
550 sharedsummary["kstest"] = "kstest";
551 sharedsummary["whittaker"] = "whittaker";
552 sharedsummary["sharednseqs"] = "sharednseqs";
553 sharedsummary["ochiai"] = "ochiai";
554 sharedsummary["anderberg"] = "anderberg";
555 sharedsummary["kulczynski"] = "kulczynski";
556 sharedsummary["kulczynskicody"] = "kulczynskicody";
557 sharedsummary["lennon"] = "lennon";
558 sharedsummary["morisitahorn"] = "morisitahorn";
559 sharedsummary["braycurtis"] = "braycurtis";
560 sharedsummary["odum"] = "odum";
561 sharedsummary["canberra"] = "canberra";
562 sharedsummary["structeuclidean"] = "structeuclidean";
563 sharedsummary["structchord"] = "structchord";
564 sharedsummary["hellinger"] = "hellinger";
565 sharedsummary["manhattan"] = "manhattan";
566 sharedsummary["structpearson"] = "structpearson";
567 sharedsummary["structkulczynski"] = "structkulczynski";
568 sharedsummary["structchi2"] = "structchi2";
569 sharedsummary["soergel"] = "soergel";
570 sharedsummary["spearman"] = "spearman";
571 sharedsummary["speciesprofile"] = "speciesprofile";
572 sharedsummary["hamming"] = "hamming";
573 sharedsummary["gower"] = "gower";
574 sharedsummary["memchi2"] = "memchi2";
575 sharedsummary["memchord"] = "memchord";
576 sharedsummary["memeuclidean"] = "memeuclidean";
577 sharedsummary["mempearson"] = "mempearson";
578 sharedsummary["jsd"] = "jsd";
579 sharedsummary["rjsd"] = "rjsd";
580 sharedsummary["default"] = "default";
582 catch(exception& e) {
583 m->errorOut(e, "ValidCalculator", "initialSharedSummary");
589 /********************************************************************/
591 void ValidCalculators::initialSharedRarefact() {
593 sharedrarefaction["sharedobserved"] = "sharedobserved";
594 sharedrarefaction["sharednseqs"] = "sharednseqs";
595 sharedrarefaction["default"] = "default";
597 catch(exception& e) {
598 m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
604 /********************************************************************/
605 void ValidCalculators::initialVennSingle() {
607 vennsingle["sobs"] = "sobs";
608 vennsingle["chao"] = "chao";
609 vennsingle["ace"] = "ace";
610 vennsingle["jack"] = "jack";
611 vennsingle["default"] = "default";
613 catch(exception& e) {
614 m->errorOut(e, "ValidCalculator", "initialVennSingle");
619 /********************************************************************/
620 void ValidCalculators::initialVennShared() {
622 vennshared["sharedsobs"] = "sharedsobs";
623 vennshared["sharedchao"] = "sharedchao";
624 vennshared["sharedace"] = "sharedace";
625 vennshared["default"] = "default";
627 catch(exception& e) {
628 m->errorOut(e, "ValidCalculator", "initialVennShared");
633 /********************************************************************/
634 void ValidCalculators::initialTreeGroups() {
636 treegroup["sharedsobs"] = "sharedsobs";
637 treegroup["sharedchao"] = "sharedchao";
638 treegroup["sharedace"] = "sharedace";
639 treegroup["jabund"] = "jabund";
640 treegroup["sorabund"] = "sorabund";
641 treegroup["jclass"] = "jclass";
642 treegroup["sorclass"] = "sorclass";
643 treegroup["jest"] = "jest";
644 treegroup["sorest"] = "sorest";
645 treegroup["thetayc"] = "thetayc";
646 treegroup["thetan"] = "thetan";
647 treegroup["kstest"] = "kstest";
648 treegroup["whittaker"] = "whittaker";
649 treegroup["sharednseqs"] = "sharednseqs";
650 treegroup["ochiai"] = "ochiai";
651 treegroup["anderberg"] = "anderberg";
652 treegroup["kulczynski"] = "kulczynski";
653 treegroup["kulczynskicody"] = "kulczynskicody";
654 treegroup["lennon"] = "lennon";
655 treegroup["morisitahorn"] = "morisitahorn";
656 treegroup["braycurtis"] = "braycurtis";
657 treegroup["odum"] = "odum";
658 treegroup["canberra"] = "canberra";
659 treegroup["structeuclidean"] = "structeuclidean";
660 treegroup["structchord"] = "structchord";
661 treegroup["hellinger"] = "hellinger";
662 treegroup["manhattan"] = "manhattan";
663 treegroup["structpearson"] = "structpearson";
664 treegroup["structkulczynski"] = "structkulczynski";
665 treegroup["structchi2"] = "structchi2";
666 treegroup["soergel"] = "soergel";
667 treegroup["spearman"] = "spearman";
668 treegroup["speciesprofile"] = "speciesprofile";
669 treegroup["hamming"] = "hamming";
670 treegroup["gower"] = "gower";
671 treegroup["memchi2"] = "memchi2";
672 treegroup["memchord"] = "memchord";
673 treegroup["memeuclidean"] = "memeuclidean";
674 treegroup["mempearson"] = "mempearson";
677 catch(exception& e) {
678 m->errorOut(e, "ValidCalculator", "initialTreeGroups");
682 /********************************************************************/
683 void ValidCalculators::initialHeat() {
685 heat["jabund"] = "jabund";
686 heat["sorabund"] = "sorabund";
687 heat["jclass"] = "jclass";
688 heat["sorclass"] = "sorclass";
689 heat["jest"] = "jest";
690 heat["sorest"] = "sorest";
691 heat["thetayc"] = "thetayc";
692 heat["thetan"] = "thetan";
693 heat["morisitahorn"] = "morisitahorn";
694 heat["braycurtis"] = "braycurtis";
696 catch(exception& e) {
697 m->errorOut(e, "ValidCalculator", "initialHeat");
702 /********************************************************************/
703 void ValidCalculators::initialMatrix() {
705 matrix["sharedsobs"] = "sharedsobs";
706 matrix["sharedchao"] = "sharedchao";
707 matrix["sharedace"] = "sharedace";
708 matrix["jabund"] = "jabund";
709 matrix["sorabund"] = "sorabund";
710 matrix["jclass"] = "jclass";
711 matrix["sorclass"] = "sorclass";
712 matrix["jest"] = "jest";
713 matrix["sorest"] = "sorest";
714 matrix["thetayc"] = "thetayc";
715 matrix["thetan"] = "thetan";
716 matrix["kstest"] = "kstest";
717 matrix["whittaker"] = "whittaker";
718 matrix["sharednseqs"] = "sharednseqs";
719 matrix["ochiai"] = "ochiai";
720 matrix["anderberg"] = "anderberg";
721 matrix["kulczynski"] = "kulczynski";
722 matrix["kulczynskicody"] = "kulczynskicody";
723 matrix["lennon"] = "lennon";
724 matrix["morisitahorn"] = "morisitahorn";
725 matrix["braycurtis"] = "braycurtis";
726 matrix["odum"] = "odum";
727 matrix["canberra"] = "canberra";
728 matrix["structeuclidean"] = "structeuclidean";
729 matrix["structchord"] = "structchord";
730 matrix["hellinger"] = "hellinger";
731 matrix["manhattan"] = "manhattan";
732 matrix["structpearson"] = "structpearson";
733 matrix["structkulczynski"] = "structkulczynski";
734 matrix["structchi2"] = "structchi2";
735 matrix["soergel"] = "soergel";
736 matrix["spearman"] = "spearman";
737 matrix["speciesprofile"] = "speciesprofile";
738 matrix["hamming"] = "hamming";
739 matrix["gower"] = "gower";
740 matrix["memchi2"] = "memchi2";
741 matrix["memchord"] = "memchord";
742 matrix["memeuclidean"] = "memeuclidean";
743 matrix["mempearson"] = "mempearson";
744 matrix["rjsd"] = "rjsd";
745 matrix["jsd"] = "jsd";
748 catch(exception& e) {
749 m->errorOut(e, "ValidCalculator", "initialMatrix");
754 /********************************************************************/
755 void ValidCalculators::initialBoot() {
757 boot["jabund"] = "jabund";
758 boot["sorabund"] = "sorabund";
759 boot["jclass"] = "jclass";
760 boot["sorclass"] = "orclass";
761 boot["jest"] = "jest";
762 boot["sorest"] = "sorest";
763 boot["thetayc"] = "thetayc";
764 boot["thetan"] = "thetan";
765 boot["morisitahorn"] = "morisitahorn";
766 boot["braycurtis"] = "braycurtis";
768 catch(exception& e) {
769 m->errorOut(e, "ValidCalculator", "initialBoot");
773 /********************************************************************/
774 void ValidCalculators::initialDistance() {
776 distance["nogaps"] = "nogaps";
777 distance["eachgap"] = "eachgap";
778 distance["onegap"] = "onegap";
780 catch(exception& e) {
781 m->errorOut(e, "ValidCalculator", "initialDistance");
786 /********************************************************************/
787 void ValidCalculators::printCalc(string parameter, ostream& out) {
789 out << "The available estimators for calc are ";
790 //are you looking for a calculator for a single parameter
791 if (parameter == "single") {
792 for (it = single.begin(); it != single.end(); it++) {
793 out << it->first << ", ";
795 //are you looking for a calculator for a shared parameter
796 }else if (parameter == "shared") {
797 for (it = shared.begin(); it != shared.end(); it++) {
798 out << it->first << ", ";
800 //are you looking for a calculator for a rarefaction parameter
801 }else if (parameter == "rarefaction") {
802 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
803 out << it->first << ", ";
805 //are you looking for a calculator for a summary parameter
806 }else if (parameter == "summary") {
807 for (it = summary.begin(); it != summary.end(); it++) {
808 out << it->first << ", ";
810 //are you looking for a calculator for a sharedsummary parameter
811 }else if (parameter == "sharedsummary") {
812 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
813 out << it->first << ", ";
815 }else if (parameter == "sharedrarefaction") {
816 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
817 out << it->first << ", ";
819 }else if (parameter == "vennsingle") {
820 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
821 out << it->first << ", ";
823 }else if (parameter == "vennshared") {
824 for (it = vennshared.begin(); it != vennshared.end(); it++) {
825 out << it->first << ", ";
827 }else if (parameter == "treegroup") {
828 for (it = treegroup.begin(); it != treegroup.end(); it++) {
829 out << it->first << ", ";
831 }else if (parameter == "matrix") {
832 for (it = matrix.begin(); it != matrix.end(); it++) {
833 out << it->first << ", ";
835 }else if (parameter == "heat") {
836 for (it = heat.begin(); it != heat.end(); it++) {
837 out << it->first << ", ";
839 }else if (parameter == "boot") {
840 for (it = boot.begin(); it != boot.end(); it++) {
841 out << it->first << ", ";
843 }else if (parameter == "distance") {
844 for (it = distance.begin(); it != distance.end(); it++) {
845 out << it->first << ", ";
851 catch(exception& e) {
852 m->errorOut(e, "ValidCalculator", "printCalc");
856 /********************************************************************/
857 string ValidCalculators::printCalc(string parameter) {
859 string output = "The available estimators for calc are ";
860 //are you looking for a calculator for a single parameter
861 if (parameter == "single") {
862 for (it = single.begin(); it != single.end(); it++) {
863 output += it->first + ", ";
865 //are you looking for a calculator for a shared parameter
866 }else if (parameter == "shared") {
867 for (it = shared.begin(); it != shared.end(); it++) {
868 output += it->first + ", ";
870 //are you looking for a calculator for a rarefaction parameter
871 }else if (parameter == "rarefaction") {
872 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
873 output += it->first + ", ";
875 //are you looking for a calculator for a summary parameter
876 }else if (parameter == "summary") {
877 for (it = summary.begin(); it != summary.end(); it++) {
878 output += it->first + ", ";
880 //are you looking for a calculator for a sharedsummary parameter
881 }else if (parameter == "sharedsummary") {
882 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
883 output += it->first + ", ";
885 }else if (parameter == "sharedrarefaction") {
886 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
887 output += it->first + ", ";
889 }else if (parameter == "vennsingle") {
890 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
891 output += it->first + ", ";
893 }else if (parameter == "vennshared") {
894 for (it = vennshared.begin(); it != vennshared.end(); it++) {
895 output += it->first + ", ";
897 }else if (parameter == "treegroup") {
898 for (it = treegroup.begin(); it != treegroup.end(); it++) {
899 output += it->first + ", ";
901 }else if (parameter == "matrix") {
902 for (it = matrix.begin(); it != matrix.end(); it++) {
903 output += it->first + ", ";
905 }else if (parameter == "heat") {
906 for (it = heat.begin(); it != heat.end(); it++) {
907 output += it->first + ", ";
909 }else if (parameter == "boot") {
910 for (it = boot.begin(); it != boot.end(); it++) {
911 output += it->first + ", ";
913 }else if (parameter == "distance") {
914 for (it = distance.begin(); it != distance.end(); it++) {
915 output += it->first + ", ";
920 output = output.substr(0, output.length()-1);
925 catch(exception& e) {
926 m->errorOut(e, "ValidCalculator", "printCalc");
930 /********************************************************************/