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"
82 /********************************************************************/
83 ValidCalculators::ValidCalculators() {
85 m = MothurOut::getInstance();
90 initialSharedRarefact();
92 initialSharedSummary();
101 for(it = single.begin(); it != single.end(); it++) { allCalcs.insert(it->first); }
102 for(it = shared.begin(); it != shared.end(); it++) { allCalcs.insert(it->first); }
103 for(it = rarefaction.begin(); it != rarefaction.end(); it++) { allCalcs.insert(it->first); }
104 for(it = summary.begin(); it != summary.end(); it++) { allCalcs.insert(it->first); }
105 for(it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) { allCalcs.insert(it->first); }
106 for(it = sharedsummary.begin(); it != sharedsummary.end(); it++) { allCalcs.insert(it->first); }
107 for(it = vennsingle.begin(); it != vennsingle.end(); it++) { allCalcs.insert(it->first); }
108 for(it = vennshared.begin(); it != vennshared.end(); it++) { allCalcs.insert(it->first); }
109 for(it = treegroup.begin(); it != treegroup.end(); it++) { allCalcs.insert(it->first); }
110 for(it = matrix.begin(); it != matrix.end(); it++) { allCalcs.insert(it->first); }
111 for(it = heat.begin(); it != heat.end(); it++) { allCalcs.insert(it->first); }
112 for(it = boot.begin(); it != boot.end(); it++) { allCalcs.insert(it->first); }
113 for(it = distance.begin(); it != distance.end(); it++) { allCalcs.insert(it->first); }
116 catch(exception& e) {
117 m->errorOut(e, "ValidCalculator", "ValidCalculator");
121 /********************************************************************/
122 ValidCalculators::~ValidCalculators() {}
123 /********************************************************************/
124 void ValidCalculators::printCitations(vector<string> Estimators) {
127 for (int i = 0; i < Estimators.size(); i++) {
128 //is this citation, do nothing
129 if ((Estimators[i] == "citation") || (Estimators[i] == "default") || (Estimators[i] == "eachgap") || (Estimators[i] == "nogaps") || (Estimators[i] == "onegap")) {}
130 //is this a valid calculator
131 else if (allCalcs.count(Estimators[i]) != 0) {
132 if (Estimators[i] == "sobs") { Calculator* temp = new Sobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
133 }else if (Estimators[i] == "chao") { Calculator* temp = new Chao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
134 }else if (Estimators[i] == "nseqs") { Calculator* temp = new NSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
135 }else if (Estimators[i] == "coverage") { Calculator* temp = new Coverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
136 }else if (Estimators[i] == "ace") { Calculator* temp = new Ace(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
138 }else if (Estimators[i] == "jack") { Calculator* temp = new Jackknife(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
139 }else if (Estimators[i] == "shannon") { Calculator* temp = new Shannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
140 }else if (Estimators[i] == "shannoneven") { Calculator* temp = new ShannonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
141 }else if (Estimators[i] == "npshannon") { Calculator* temp = new NPShannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
142 }else if (Estimators[i] == "heip") { Calculator* temp = new Heip(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
144 }else if (Estimators[i] == "smithwilson") { Calculator* temp = new SmithWilson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
145 }else if (Estimators[i] == "simpson") { Calculator* temp = new Simpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
146 }else if (Estimators[i] == "simpsoneven") { Calculator* temp = new SimpsonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
147 }else if (Estimators[i] == "invsimpson") { Calculator* temp = new InvSimpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
148 }else if (Estimators[i] == "bootstrap") { Calculator* temp = new Bootstrap(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
150 }else if (Estimators[i] == "geometric") { Calculator* temp = new Geom(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
151 }else if (Estimators[i] == "qstat") { Calculator* temp = new QStat(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
152 }else if (Estimators[i] == "logseries") { Calculator* temp = new LogSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
153 }else if (Estimators[i] == "bergerparker") { Calculator* temp = new BergerParker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
154 }else if (Estimators[i] == "bstick") { Calculator* temp = new BStick(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
156 }else if (Estimators[i] == "goodscoverage") { Calculator* temp = new GoodsCoverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
157 }else if (Estimators[i] == "efron") { Calculator* temp = new Efron(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
158 }else if (Estimators[i] == "boneh") { Calculator* temp = new Boneh(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
159 }else if (Estimators[i] == "solow") { Calculator* temp = new Solow(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
160 }else if (Estimators[i] == "shen") { Calculator* temp = new Shen(10, 10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
162 }else if (Estimators[i] == "sharedchao") { Calculator* temp = new SharedChao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
163 }else if (Estimators[i] == "sharedsobs") { Calculator* temp = new SharedSobsCS(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
164 }else if (Estimators[i] == "sharedace") { Calculator* temp = new SharedAce(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
165 }else if (Estimators[i] == "jabund") { Calculator* temp = new JAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
166 }else if (Estimators[i] == "sorabund") { Calculator* temp = new SorAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
168 }else if (Estimators[i] == "jclass") { Calculator* temp = new Jclass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
169 }else if (Estimators[i] == "sorclass") { Calculator* temp = new SorClass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
170 }else if (Estimators[i] == "jest") { Calculator* temp = new Jest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
171 }else if (Estimators[i] == "sorest") { Calculator* temp = new SorEst(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
172 }else if (Estimators[i] == "thetayc") { Calculator* temp = new ThetaYC(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
174 }else if (Estimators[i] == "thetan") { Calculator* temp = new ThetaN(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
175 }else if (Estimators[i] == "kstest") { Calculator* temp = new KSTest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
176 }else if (Estimators[i] == "whittaker") { Calculator* temp = new Whittaker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
177 }else if (Estimators[i] == "sharednseqs") { Calculator* temp = new SharedNSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
178 }else if (Estimators[i] == "ochiai") { Calculator* temp = new Ochiai(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
180 }else if (Estimators[i] == "anderberg") { Calculator* temp = new Anderberg(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
181 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
182 }else if (Estimators[i] == "kulczynskicody") { Calculator* temp = new KulczynskiCody(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
183 }else if (Estimators[i] == "lennon") { Calculator* temp = new Lennon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
184 }else if (Estimators[i] == "morisitahorn") { Calculator* temp = new MorHorn(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
186 }else if (Estimators[i] == "braycurtis") { Calculator* temp = new BrayCurtis(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
187 }else if (Estimators[i] == "odum") { Calculator* temp = new Odum(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
188 }else if (Estimators[i] == "canberra") { Calculator* temp = new Canberra(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
189 }else if (Estimators[i] == "structeuclidean") { Calculator* temp = new StructEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
190 }else if (Estimators[i] == "structchord") { Calculator* temp = new StructChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
192 }else if (Estimators[i] == "hellinger") { Calculator* temp = new Hellinger(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
193 }else if (Estimators[i] == "manhattan") { Calculator* temp = new Manhattan(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
194 }else if (Estimators[i] == "structpearson") { Calculator* temp = new StructPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
195 }else if (Estimators[i] == "soergel") { Calculator* temp = new Soergel(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
196 }else if (Estimators[i] == "spearman") { Calculator* temp = new Spearman(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
198 }else if (Estimators[i] == "structkulczynski") { Calculator* temp = new StructKulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
199 }else if (Estimators[i] == "speciesprofile") { Calculator* temp = new SpeciesProfile(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
200 }else if (Estimators[i] == "hamming") { Calculator* temp = new Hamming(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
201 }else if (Estimators[i] == "structchi2") { Calculator* temp = new StructChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
202 }else if (Estimators[i] == "gower") { Calculator* temp = new Gower(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
204 }else if (Estimators[i] == "memchi2") { Calculator* temp = new MemChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
205 }else if (Estimators[i] == "memchord") { Calculator* temp = new MemChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
206 }else if (Estimators[i] == "memeuclidean") { Calculator* temp = new MemEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
207 }else if (Estimators[i] == "mempearson") { Calculator* temp = new MemPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
208 }else if (Estimators[i] == "sharedobserved") { Calculator* temp = new SharedSobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
209 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
210 }else if (Estimators[i] == "jsd") { Calculator* temp = new JSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
211 }else { m->mothurOut("[ERROR]: Missing else if for " + Estimators[i] + " in printCitations."); m->mothurOutEndLine(); }
212 }else { m->mothurOut(Estimators[i] + " is not a valid calculator, no citation will be given."); m->mothurOutEndLine(); }
216 catch(exception& e) {
217 m->errorOut(e, "ValidCalculator", "printCitations");
221 /********************************************************************/
223 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
225 //are you looking for a calculator for a single parameter
226 if (parameter == "single") {
228 if ((single.find(calculator)) != (single.end())) {
231 m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
232 for (it = single.begin(); it != single.end(); it++) {
233 m->mothurOut(it->first + ", ");
235 m->mothurOutEndLine();
237 //are you looking for a calculator for a shared parameter
238 }else if (parameter == "shared") {
240 if ((shared.find(calculator)) != (shared.end())) {
243 m->mothurOut(calculator + " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ");
244 for (it = shared.begin(); it != shared.end(); it++) {
245 m->mothurOut(it->first + ", ");
247 m->mothurOutEndLine();
249 //are you looking for a calculator for a rarefaction parameter
250 }else if (parameter == "rarefaction") {
252 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
255 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
256 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
257 m->mothurOut(it->first + ", ");
259 m->mothurOutEndLine();
261 //are you looking for a calculator for a summary parameter
262 }else if (parameter == "summary") {
264 if ((summary.find(calculator)) != (summary.end())) {
267 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
268 for (it = summary.begin(); it != summary.end(); it++) {
269 m->mothurOut(it->first + ", ");
271 m->mothurOutEndLine();
273 //are you looking for a calculator for a sharedsummary parameter
274 }else if (parameter == "sharedsummary") {
276 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
279 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
280 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
281 m->mothurOut(it->first + ", ");
283 m->mothurOutEndLine();
285 }else if (parameter == "sharedrarefaction") {
287 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
290 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
291 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
292 m->mothurOut(it->first + ", ");
294 m->mothurOutEndLine();
296 }else if (parameter == "vennsingle") {
298 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
301 m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
302 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
303 m->mothurOut(it->first + ", ");
305 m->mothurOutEndLine();
307 }else if (parameter == "vennshared") {
309 if ((vennshared.find(calculator)) != (vennshared.end())) {
312 m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
313 for (it = vennshared.begin(); it != vennshared.end(); it++) {
314 m->mothurOut(it->first + ", ");
316 m->mothurOutEndLine();
318 }else if (parameter == "treegroup") {
320 if ((treegroup.find(calculator)) != (treegroup.end())) {
323 m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
324 for (it = treegroup.begin(); it != treegroup.end(); it++) {
325 m->mothurOut(it->first + ", ");
327 m->mothurOutEndLine();
329 }else if (parameter == "matrix") {
331 if ((matrix.find(calculator)) != (matrix.end())) {
334 m->mothurOut(calculator + " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
335 for (it = matrix.begin(); it != matrix.end(); it++) {
336 m->mothurOut(it->first + ", ");
338 m->mothurOutEndLine();
340 }else if (parameter == "heat") {
342 if ((heat.find(calculator)) != (heat.end())) {
345 m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
346 for (it = heat.begin(); it != heat.end(); it++) {
347 m->mothurOut(it->first + ", ");
349 m->mothurOutEndLine();
351 }else if (parameter == "boot") {
353 if ((boot.find(calculator)) != (boot.end())) {
356 m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
357 for (it = boot.begin(); it != boot.end(); it++) {
358 m->mothurOut(it->first + ", ");
360 m->mothurOutEndLine();
362 }else if (parameter == "distance") {
364 if ((distance.find(calculator)) != (distance.end())) {
367 m->mothurOut(calculator + " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
368 for (it = distance.begin(); it != distance.end(); it++) {
369 m->mothurOut(it->first + ", ");
371 m->mothurOutEndLine();
373 //not a valid parameter
374 }else { return false; }
377 catch(exception& e) {
378 m->errorOut(e, "ValidCalculator", "isValidCalculator");
383 /********************************************************************/
384 void ValidCalculators::initialSingle() {
386 single["sobs"] = "sobs";
387 single["chao"] = "chao";
388 single["ace"] = "ace";
389 single["jack"] = "jack";
390 single["shannon"] = "shannon";
391 single["npshannon"] = "npshannon";
392 single["shannoneven"] = "shannoneven";
393 single["smithwilson"] = "smithwilson";
394 single["heip"] = "heip";
395 single["simpson"] = "simpson";
396 single["simpsoneven"] = "simpsoneven";
397 single["invsimpson"] = "invsimpson";
398 single["bergerparker"] = "bergerparker";
399 single["bootstrap"] = "bootstrap";
400 single["geometric"] = "geometric";
401 single["logseries"] = "logseries";
402 single["qstat"] = "qstat";
403 single["bstick"] = "bstick";
404 single["goodscoverage"] = "goodscoverage";
405 single["nseqs"] = "nseqs";
406 single["coverage"] = "coverage";
407 single["efron"] = "efron";
408 single["boneh"] = "boneh";
409 single["solow"] = "solow";
410 single["shen"] = "shen";
411 single["default"] = "default";
413 catch(exception& e) {
414 m->errorOut(e, "ValidCalculator", "initialSingle");
419 /********************************************************************/
420 void ValidCalculators::initialShared() {
422 shared["sharedsobs"] = "sharedsobs";
423 shared["sharedchao"] = "sharedchao";
424 shared["sharedace"] = "sharedace";
425 shared["jabund"] = "jabund";
426 shared["sorabund"] = "sorabund";
427 shared["jclass"] = "jclass";
428 shared["sorclass"] = "sorclass";
429 shared["jest"] = "jest";
430 shared["sorest"] = "sorest";
431 shared["thetayc"] = "thetayc";
432 shared["thetan"] = "thetan";
433 shared["kstest"] = "kstest";
434 shared["whittaker"] = "whittaker";
435 shared["sharednseqs"] = "sharednseqs";
436 shared["ochiai"] = "ochiai";
437 shared["anderberg"] = "anderberg";
438 shared["kulczynski"] = "kulczynski";
439 shared["kulczynskicody"] = "kulczynskicody";
440 shared["lennon"] = "lennon";
441 shared["morisitahorn"] = "morisitahorn";
442 shared["braycurtis"] = "braycurtis";
443 shared["odum"] = "odum";
444 shared["canberra"] = "canberra";
445 shared["structeuclidean"] = "structeuclidean";
446 shared["structchord"] = "structchord";
447 shared["hellinger"] = "hellinger";
448 shared["manhattan"] = "manhattan";
449 shared["structpearson"] = "structpearson";
450 shared["soergel"] = "soergel";
451 shared["spearman"] = "spearman";
452 shared["structkulczynski"] = "structkulczynski";
453 shared["structchi2"] = "structchi2";
454 shared["speciesprofile"] = "speciesprofile";
455 shared["hamming"] = "hamming";
456 shared["gower"] = "gower";
457 shared["memchi2"] = "memchi2";
458 shared["memchord"] = "memchord";
459 shared["memeuclidean"] = "memeuclidean";
460 shared["mempearson"] = "mempearson";
461 shared["jsd"] = "jsd";
462 shared["default"] = "default";
464 catch(exception& e) {
465 m->errorOut(e, "ValidCalculator", "initialShared");
470 /********************************************************************/
471 void ValidCalculators::initialRarefaction() {
473 rarefaction["sobs"] = "sobs";
474 rarefaction["chao"] = "chao";
475 rarefaction["ace"] = "ace";
476 rarefaction["jack"] = "jack";
477 rarefaction["shannon"] = "shannon";
478 rarefaction["smithwilson"] = "smithwilson";
479 rarefaction["heip"] = "heip";
480 rarefaction["npshannon"] = "npshannon";
481 rarefaction["shannoneven"] = "shannoneven";
482 rarefaction["simpson"] = "simpson";
483 rarefaction["invsimpson"] = "invsimpson";
484 rarefaction["simpsoneven"] = "simpsoneven";
485 rarefaction["bootstrap"] = "bootstrap";
486 rarefaction["nseqs"] = "nseqs";
487 rarefaction["coverage"] = "coverage";
488 rarefaction["default"] = "default";
490 catch(exception& e) {
491 m->errorOut(e, "ValidCalculator", "initialRarefaction");
496 /********************************************************************/
498 void ValidCalculators::initialSummary() {
500 summary["sobs"] = "sobs";
501 summary["chao"] = "chao";
502 summary["ace"] = "ace";
503 summary["jack"] = "jack";
504 summary["shannon"] = "shannon";
505 summary["heip"] = "heip";
506 summary["shannoneven"] = "shannoneven";
507 summary["smithwilson"] = "smithwilson";
508 summary["invsimpson"] = "invsimpson";
509 summary["npshannon"] = "npshannon";
510 summary["simpson"] = "simpson";
511 summary["simpsoneven"] = "simpsoneven";
512 summary["bergerparker"] = "bergerparker";
513 summary["geometric"] = "geometric";
514 summary["bootstrap"] = "bootstrap";
515 summary["logseries"] = "logseries";
516 summary["qstat"] = "qstat";
517 summary["bstick"] = "bstick";
518 summary["nseqs"] = "nseqs";
519 summary["goodscoverage"]= "goodscoverage";
520 summary["coverage"] = "coverage";
521 summary["efron"] = "efron";
522 summary["boneh"] = "boneh";
523 summary["solow"] = "solow";
524 summary["shen"] = "shen";
525 summary["default"] = "default";
527 catch(exception& e) {
528 m->errorOut(e, "ValidCalculator", "initialSummary");
533 /********************************************************************/
534 void ValidCalculators::initialSharedSummary() {
536 sharedsummary["sharedsobs"] = "sharedsobs";
537 sharedsummary["sharedchao"] = "sharedchao";
538 sharedsummary["sharedace"] = "sharedace";
539 sharedsummary["jabund"] = "jabund";
540 sharedsummary["sorabund"] = "sorabund";
541 sharedsummary["jclass"] = "jclass";
542 sharedsummary["sorclass"] = "sorclass";
543 sharedsummary["jest"] = "jest";
544 sharedsummary["sorest"] = "sorest";
545 sharedsummary["thetayc"] = "thetayc";
546 sharedsummary["thetan"] = "thetan";
547 sharedsummary["kstest"] = "kstest";
548 sharedsummary["whittaker"] = "whittaker";
549 sharedsummary["sharednseqs"] = "sharednseqs";
550 sharedsummary["ochiai"] = "ochiai";
551 sharedsummary["anderberg"] = "anderberg";
552 sharedsummary["kulczynski"] = "kulczynski";
553 sharedsummary["kulczynskicody"] = "kulczynskicody";
554 sharedsummary["lennon"] = "lennon";
555 sharedsummary["morisitahorn"] = "morisitahorn";
556 sharedsummary["braycurtis"] = "braycurtis";
557 sharedsummary["odum"] = "odum";
558 sharedsummary["canberra"] = "canberra";
559 sharedsummary["structeuclidean"] = "structeuclidean";
560 sharedsummary["structchord"] = "structchord";
561 sharedsummary["hellinger"] = "hellinger";
562 sharedsummary["manhattan"] = "manhattan";
563 sharedsummary["structpearson"] = "structpearson";
564 sharedsummary["structkulczynski"] = "structkulczynski";
565 sharedsummary["structchi2"] = "structchi2";
566 sharedsummary["soergel"] = "soergel";
567 sharedsummary["spearman"] = "spearman";
568 sharedsummary["speciesprofile"] = "speciesprofile";
569 sharedsummary["hamming"] = "hamming";
570 sharedsummary["gower"] = "gower";
571 sharedsummary["memchi2"] = "memchi2";
572 sharedsummary["memchord"] = "memchord";
573 sharedsummary["memeuclidean"] = "memeuclidean";
574 sharedsummary["mempearson"] = "mempearson";
575 sharedsummary["jsd"] = "jsd";
576 sharedsummary["default"] = "default";
578 catch(exception& e) {
579 m->errorOut(e, "ValidCalculator", "initialSharedSummary");
585 /********************************************************************/
587 void ValidCalculators::initialSharedRarefact() {
589 sharedrarefaction["sharedobserved"] = "sharedobserved";
590 sharedrarefaction["sharednseqs"] = "sharednseqs";
591 sharedrarefaction["default"] = "default";
593 catch(exception& e) {
594 m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
600 /********************************************************************/
601 void ValidCalculators::initialVennSingle() {
603 vennsingle["sobs"] = "sobs";
604 vennsingle["chao"] = "chao";
605 vennsingle["ace"] = "ace";
606 vennsingle["jack"] = "jack";
607 vennsingle["default"] = "default";
609 catch(exception& e) {
610 m->errorOut(e, "ValidCalculator", "initialVennSingle");
615 /********************************************************************/
616 void ValidCalculators::initialVennShared() {
618 vennshared["sharedsobs"] = "sharedsobs";
619 vennshared["sharedchao"] = "sharedchao";
620 vennshared["sharedace"] = "sharedace";
621 vennshared["default"] = "default";
623 catch(exception& e) {
624 m->errorOut(e, "ValidCalculator", "initialVennShared");
629 /********************************************************************/
630 void ValidCalculators::initialTreeGroups() {
632 treegroup["sharedsobs"] = "sharedsobs";
633 treegroup["sharedchao"] = "sharedchao";
634 treegroup["sharedace"] = "sharedace";
635 treegroup["jabund"] = "jabund";
636 treegroup["sorabund"] = "sorabund";
637 treegroup["jclass"] = "jclass";
638 treegroup["sorclass"] = "sorclass";
639 treegroup["jest"] = "jest";
640 treegroup["sorest"] = "sorest";
641 treegroup["thetayc"] = "thetayc";
642 treegroup["thetan"] = "thetan";
643 treegroup["kstest"] = "kstest";
644 treegroup["whittaker"] = "whittaker";
645 treegroup["sharednseqs"] = "sharednseqs";
646 treegroup["ochiai"] = "ochiai";
647 treegroup["anderberg"] = "anderberg";
648 treegroup["kulczynski"] = "kulczynski";
649 treegroup["kulczynskicody"] = "kulczynskicody";
650 treegroup["lennon"] = "lennon";
651 treegroup["morisitahorn"] = "morisitahorn";
652 treegroup["braycurtis"] = "braycurtis";
653 treegroup["odum"] = "odum";
654 treegroup["canberra"] = "canberra";
655 treegroup["structeuclidean"] = "structeuclidean";
656 treegroup["structchord"] = "structchord";
657 treegroup["hellinger"] = "hellinger";
658 treegroup["manhattan"] = "manhattan";
659 treegroup["structpearson"] = "structpearson";
660 treegroup["structkulczynski"] = "structkulczynski";
661 treegroup["structchi2"] = "structchi2";
662 treegroup["soergel"] = "soergel";
663 treegroup["spearman"] = "spearman";
664 treegroup["speciesprofile"] = "speciesprofile";
665 treegroup["hamming"] = "hamming";
666 treegroup["gower"] = "gower";
667 treegroup["memchi2"] = "memchi2";
668 treegroup["memchord"] = "memchord";
669 treegroup["memeuclidean"] = "memeuclidean";
670 treegroup["mempearson"] = "mempearson";
673 catch(exception& e) {
674 m->errorOut(e, "ValidCalculator", "initialTreeGroups");
678 /********************************************************************/
679 void ValidCalculators::initialHeat() {
681 heat["jabund"] = "jabund";
682 heat["sorabund"] = "sorabund";
683 heat["jclass"] = "jclass";
684 heat["sorclass"] = "sorclass";
685 heat["jest"] = "jest";
686 heat["sorest"] = "sorest";
687 heat["thetayc"] = "thetayc";
688 heat["thetan"] = "thetan";
689 heat["morisitahorn"] = "morisitahorn";
690 heat["braycurtis"] = "braycurtis";
692 catch(exception& e) {
693 m->errorOut(e, "ValidCalculator", "initialHeat");
698 /********************************************************************/
699 void ValidCalculators::initialMatrix() {
701 matrix["sharedsobs"] = "sharedsobs";
702 matrix["sharedchao"] = "sharedchao";
703 matrix["sharedace"] = "sharedace";
704 matrix["jabund"] = "jabund";
705 matrix["sorabund"] = "sorabund";
706 matrix["jclass"] = "jclass";
707 matrix["sorclass"] = "sorclass";
708 matrix["jest"] = "jest";
709 matrix["sorest"] = "sorest";
710 matrix["thetayc"] = "thetayc";
711 matrix["thetan"] = "thetan";
712 matrix["kstest"] = "kstest";
713 matrix["whittaker"] = "whittaker";
714 matrix["sharednseqs"] = "sharednseqs";
715 matrix["ochiai"] = "ochiai";
716 matrix["anderberg"] = "anderberg";
717 matrix["kulczynski"] = "kulczynski";
718 matrix["kulczynskicody"] = "kulczynskicody";
719 matrix["lennon"] = "lennon";
720 matrix["morisitahorn"] = "morisitahorn";
721 matrix["braycurtis"] = "braycurtis";
722 matrix["odum"] = "odum";
723 matrix["canberra"] = "canberra";
724 matrix["structeuclidean"] = "structeuclidean";
725 matrix["structchord"] = "structchord";
726 matrix["hellinger"] = "hellinger";
727 matrix["manhattan"] = "manhattan";
728 matrix["structpearson"] = "structpearson";
729 matrix["structkulczynski"] = "structkulczynski";
730 matrix["structchi2"] = "structchi2";
731 matrix["soergel"] = "soergel";
732 matrix["spearman"] = "spearman";
733 matrix["speciesprofile"] = "speciesprofile";
734 matrix["hamming"] = "hamming";
735 matrix["gower"] = "gower";
736 matrix["memchi2"] = "memchi2";
737 matrix["memchord"] = "memchord";
738 matrix["memeuclidean"] = "memeuclidean";
739 matrix["mempearson"] = "mempearson";
740 matrix["jsd"] = "jsd";
743 catch(exception& e) {
744 m->errorOut(e, "ValidCalculator", "initialMatrix");
749 /********************************************************************/
750 void ValidCalculators::initialBoot() {
752 boot["jabund"] = "jabund";
753 boot["sorabund"] = "sorabund";
754 boot["jclass"] = "jclass";
755 boot["sorclass"] = "orclass";
756 boot["jest"] = "jest";
757 boot["sorest"] = "sorest";
758 boot["thetayc"] = "thetayc";
759 boot["thetan"] = "thetan";
760 boot["morisitahorn"] = "morisitahorn";
761 boot["braycurtis"] = "braycurtis";
763 catch(exception& e) {
764 m->errorOut(e, "ValidCalculator", "initialBoot");
768 /********************************************************************/
769 void ValidCalculators::initialDistance() {
771 distance["nogaps"] = "nogaps";
772 distance["eachgap"] = "eachgap";
773 distance["onegap"] = "onegap";
775 catch(exception& e) {
776 m->errorOut(e, "ValidCalculator", "initialDistance");
781 /********************************************************************/
782 void ValidCalculators::printCalc(string parameter, ostream& out) {
784 out << "The available estimators for calc are ";
785 //are you looking for a calculator for a single parameter
786 if (parameter == "single") {
787 for (it = single.begin(); it != single.end(); it++) {
788 out << it->first << ", ";
790 //are you looking for a calculator for a shared parameter
791 }else if (parameter == "shared") {
792 for (it = shared.begin(); it != shared.end(); it++) {
793 out << it->first << ", ";
795 //are you looking for a calculator for a rarefaction parameter
796 }else if (parameter == "rarefaction") {
797 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
798 out << it->first << ", ";
800 //are you looking for a calculator for a summary parameter
801 }else if (parameter == "summary") {
802 for (it = summary.begin(); it != summary.end(); it++) {
803 out << it->first << ", ";
805 //are you looking for a calculator for a sharedsummary parameter
806 }else if (parameter == "sharedsummary") {
807 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
808 out << it->first << ", ";
810 }else if (parameter == "sharedrarefaction") {
811 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
812 out << it->first << ", ";
814 }else if (parameter == "vennsingle") {
815 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
816 out << it->first << ", ";
818 }else if (parameter == "vennshared") {
819 for (it = vennshared.begin(); it != vennshared.end(); it++) {
820 out << it->first << ", ";
822 }else if (parameter == "treegroup") {
823 for (it = treegroup.begin(); it != treegroup.end(); it++) {
824 out << it->first << ", ";
826 }else if (parameter == "matrix") {
827 for (it = matrix.begin(); it != matrix.end(); it++) {
828 out << it->first << ", ";
830 }else if (parameter == "heat") {
831 for (it = heat.begin(); it != heat.end(); it++) {
832 out << it->first << ", ";
834 }else if (parameter == "boot") {
835 for (it = boot.begin(); it != boot.end(); it++) {
836 out << it->first << ", ";
838 }else if (parameter == "distance") {
839 for (it = distance.begin(); it != distance.end(); it++) {
840 out << it->first << ", ";
846 catch(exception& e) {
847 m->errorOut(e, "ValidCalculator", "printCalc");
851 /********************************************************************/
852 string ValidCalculators::printCalc(string parameter) {
854 string output = "The available estimators for calc are ";
855 //are you looking for a calculator for a single parameter
856 if (parameter == "single") {
857 for (it = single.begin(); it != single.end(); it++) {
858 output += it->first + ", ";
860 //are you looking for a calculator for a shared parameter
861 }else if (parameter == "shared") {
862 for (it = shared.begin(); it != shared.end(); it++) {
863 output += it->first + ", ";
865 //are you looking for a calculator for a rarefaction parameter
866 }else if (parameter == "rarefaction") {
867 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
868 output += it->first + ", ";
870 //are you looking for a calculator for a summary parameter
871 }else if (parameter == "summary") {
872 for (it = summary.begin(); it != summary.end(); it++) {
873 output += it->first + ", ";
875 //are you looking for a calculator for a sharedsummary parameter
876 }else if (parameter == "sharedsummary") {
877 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
878 output += it->first + ", ";
880 }else if (parameter == "sharedrarefaction") {
881 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
882 output += it->first + ", ";
884 }else if (parameter == "vennsingle") {
885 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
886 output += it->first + ", ";
888 }else if (parameter == "vennshared") {
889 for (it = vennshared.begin(); it != vennshared.end(); it++) {
890 output += it->first + ", ";
892 }else if (parameter == "treegroup") {
893 for (it = treegroup.begin(); it != treegroup.end(); it++) {
894 output += it->first + ", ";
896 }else if (parameter == "matrix") {
897 for (it = matrix.begin(); it != matrix.end(); it++) {
898 output += it->first + ", ";
900 }else if (parameter == "heat") {
901 for (it = heat.begin(); it != heat.end(); it++) {
902 output += it->first + ", ";
904 }else if (parameter == "boot") {
905 for (it = boot.begin(); it != boot.end(); it++) {
906 output += it->first + ", ";
908 }else if (parameter == "distance") {
909 for (it = distance.begin(); it != distance.end(); it++) {
910 output += it->first + ", ";
915 output = output.substr(0, output.length()-1);
920 catch(exception& e) {
921 m->errorOut(e, "ValidCalculator", "printCalc");
925 /********************************************************************/