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"
81 #include "shannonrange.h"
84 /********************************************************************/
85 ValidCalculators::ValidCalculators() {
87 m = MothurOut::getInstance();
92 initialSharedRarefact();
94 initialSharedSummary();
103 for(it = single.begin(); it != single.end(); it++) { allCalcs.insert(it->first); }
104 for(it = shared.begin(); it != shared.end(); it++) { allCalcs.insert(it->first); }
105 for(it = rarefaction.begin(); it != rarefaction.end(); it++) { allCalcs.insert(it->first); }
106 for(it = summary.begin(); it != summary.end(); it++) { allCalcs.insert(it->first); }
107 for(it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) { allCalcs.insert(it->first); }
108 for(it = sharedsummary.begin(); it != sharedsummary.end(); it++) { allCalcs.insert(it->first); }
109 for(it = vennsingle.begin(); it != vennsingle.end(); it++) { allCalcs.insert(it->first); }
110 for(it = vennshared.begin(); it != vennshared.end(); it++) { allCalcs.insert(it->first); }
111 for(it = treegroup.begin(); it != treegroup.end(); it++) { allCalcs.insert(it->first); }
112 for(it = matrix.begin(); it != matrix.end(); it++) { allCalcs.insert(it->first); }
113 for(it = heat.begin(); it != heat.end(); it++) { allCalcs.insert(it->first); }
114 for(it = boot.begin(); it != boot.end(); it++) { allCalcs.insert(it->first); }
115 for(it = distance.begin(); it != distance.end(); it++) { allCalcs.insert(it->first); }
118 catch(exception& e) {
119 m->errorOut(e, "ValidCalculator", "ValidCalculator");
123 /********************************************************************/
124 ValidCalculators::~ValidCalculators() {}
125 /********************************************************************/
126 void ValidCalculators::printCitations(vector<string> Estimators) {
129 for (int i = 0; i < Estimators.size(); i++) {
130 //is this citation, do nothing
131 if ((Estimators[i] == "citation") || (Estimators[i] == "default") || (Estimators[i] == "eachgap") || (Estimators[i] == "nogaps") || (Estimators[i] == "onegap")) {}
132 //is this a valid calculator
133 else if (allCalcs.count(Estimators[i]) != 0) {
134 if (Estimators[i] == "sobs") { Calculator* temp = new Sobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
135 }else if (Estimators[i] == "chao") { Calculator* temp = new Chao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
136 }else if (Estimators[i] == "nseqs") { Calculator* temp = new NSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
137 }else if (Estimators[i] == "coverage") { Calculator* temp = new Coverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
138 }else if (Estimators[i] == "ace") { Calculator* temp = new Ace(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
140 }else if (Estimators[i] == "jack") { Calculator* temp = new Jackknife(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
141 }else if (Estimators[i] == "shannon") { Calculator* temp = new Shannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
142 }else if (Estimators[i] == "shannoneven") { Calculator* temp = new ShannonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
143 }else if (Estimators[i] == "shannonrange") { Calculator* temp = new RangeShannon(0); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
144 }else if (Estimators[i] == "npshannon") { Calculator* temp = new NPShannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
145 }else if (Estimators[i] == "heip") { Calculator* temp = new Heip(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
147 }else if (Estimators[i] == "smithwilson") { Calculator* temp = new SmithWilson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
148 }else if (Estimators[i] == "simpson") { Calculator* temp = new Simpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
149 }else if (Estimators[i] == "simpsoneven") { Calculator* temp = new SimpsonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
150 }else if (Estimators[i] == "invsimpson") { Calculator* temp = new InvSimpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
151 }else if (Estimators[i] == "bootstrap") { Calculator* temp = new Bootstrap(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
153 }else if (Estimators[i] == "geometric") { Calculator* temp = new Geom(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
154 }else if (Estimators[i] == "qstat") { Calculator* temp = new QStat(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
155 }else if (Estimators[i] == "logseries") { Calculator* temp = new LogSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
156 }else if (Estimators[i] == "bergerparker") { Calculator* temp = new BergerParker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
157 }else if (Estimators[i] == "bstick") { Calculator* temp = new BStick(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
159 }else if (Estimators[i] == "goodscoverage") { Calculator* temp = new GoodsCoverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
160 }else if (Estimators[i] == "efron") { Calculator* temp = new Efron(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
161 }else if (Estimators[i] == "boneh") { Calculator* temp = new Boneh(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
162 }else if (Estimators[i] == "solow") { Calculator* temp = new Solow(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
163 }else if (Estimators[i] == "shen") { Calculator* temp = new Shen(10, 10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
165 }else if (Estimators[i] == "sharedchao") { Calculator* temp = new SharedChao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
166 }else if (Estimators[i] == "sharedsobs") { Calculator* temp = new SharedSobsCS(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
167 }else if (Estimators[i] == "sharedace") { Calculator* temp = new SharedAce(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
168 }else if (Estimators[i] == "jabund") { Calculator* temp = new JAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
169 }else if (Estimators[i] == "sorabund") { Calculator* temp = new SorAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
171 }else if (Estimators[i] == "jclass") { Calculator* temp = new Jclass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
172 }else if (Estimators[i] == "sorclass") { Calculator* temp = new SorClass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
173 }else if (Estimators[i] == "jest") { Calculator* temp = new Jest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
174 }else if (Estimators[i] == "sorest") { Calculator* temp = new SorEst(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
175 }else if (Estimators[i] == "thetayc") { Calculator* temp = new ThetaYC(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
177 }else if (Estimators[i] == "thetan") { Calculator* temp = new ThetaN(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
178 }else if (Estimators[i] == "kstest") { Calculator* temp = new KSTest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
179 }else if (Estimators[i] == "whittaker") { Calculator* temp = new Whittaker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
180 }else if (Estimators[i] == "sharednseqs") { Calculator* temp = new SharedNSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
181 }else if (Estimators[i] == "ochiai") { Calculator* temp = new Ochiai(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
183 }else if (Estimators[i] == "anderberg") { Calculator* temp = new Anderberg(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
184 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
185 }else if (Estimators[i] == "kulczynskicody") { Calculator* temp = new KulczynskiCody(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
186 }else if (Estimators[i] == "lennon") { Calculator* temp = new Lennon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
187 }else if (Estimators[i] == "morisitahorn") { Calculator* temp = new MorHorn(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
189 }else if (Estimators[i] == "braycurtis") { Calculator* temp = new BrayCurtis(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
190 }else if (Estimators[i] == "odum") { Calculator* temp = new Odum(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
191 }else if (Estimators[i] == "canberra") { Calculator* temp = new Canberra(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
192 }else if (Estimators[i] == "structeuclidean") { Calculator* temp = new StructEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
193 }else if (Estimators[i] == "structchord") { Calculator* temp = new StructChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
195 }else if (Estimators[i] == "hellinger") { Calculator* temp = new Hellinger(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
196 }else if (Estimators[i] == "manhattan") { Calculator* temp = new Manhattan(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
197 }else if (Estimators[i] == "structpearson") { Calculator* temp = new StructPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
198 }else if (Estimators[i] == "soergel") { Calculator* temp = new Soergel(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
199 }else if (Estimators[i] == "spearman") { Calculator* temp = new Spearman(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
201 }else if (Estimators[i] == "structkulczynski") { Calculator* temp = new StructKulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
202 }else if (Estimators[i] == "speciesprofile") { Calculator* temp = new SpeciesProfile(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
203 }else if (Estimators[i] == "hamming") { Calculator* temp = new Hamming(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
204 }else if (Estimators[i] == "structchi2") { Calculator* temp = new StructChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
205 }else if (Estimators[i] == "gower") { Calculator* temp = new Gower(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
207 }else if (Estimators[i] == "memchi2") { Calculator* temp = new MemChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
208 }else if (Estimators[i] == "memchord") { Calculator* temp = new MemChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
209 }else if (Estimators[i] == "memeuclidean") { Calculator* temp = new MemEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
210 }else if (Estimators[i] == "mempearson") { Calculator* temp = new MemPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
211 }else if (Estimators[i] == "sharedobserved") { Calculator* temp = new SharedSobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
212 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
213 }else if (Estimators[i] == "jsd") { Calculator* temp = new JSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
214 }else if (Estimators[i] == "rjsd") { Calculator* temp = new RJSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
215 }else { m->mothurOut("[ERROR]: Missing else if for " + Estimators[i] + " in printCitations."); m->mothurOutEndLine(); }
216 }else { m->mothurOut(Estimators[i] + " is not a valid calculator, no citation will be given."); m->mothurOutEndLine(); }
220 catch(exception& e) {
221 m->errorOut(e, "ValidCalculator", "printCitations");
225 /********************************************************************/
227 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
229 //are you looking for a calculator for a single parameter
230 if (parameter == "single") {
232 if ((single.find(calculator)) != (single.end())) {
235 m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
236 for (it = single.begin(); it != single.end(); it++) {
237 m->mothurOut(it->first + ", ");
239 m->mothurOutEndLine();
241 //are you looking for a calculator for a shared parameter
242 }else if (parameter == "shared") {
244 if ((shared.find(calculator)) != (shared.end())) {
247 m->mothurOut(calculator + " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ");
248 for (it = shared.begin(); it != shared.end(); it++) {
249 m->mothurOut(it->first + ", ");
251 m->mothurOutEndLine();
253 //are you looking for a calculator for a rarefaction parameter
254 }else if (parameter == "rarefaction") {
256 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
259 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
260 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
261 m->mothurOut(it->first + ", ");
263 m->mothurOutEndLine();
265 //are you looking for a calculator for a summary parameter
266 }else if (parameter == "summary") {
268 if ((summary.find(calculator)) != (summary.end())) {
271 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
272 for (it = summary.begin(); it != summary.end(); it++) {
273 m->mothurOut(it->first + ", ");
275 m->mothurOutEndLine();
277 //are you looking for a calculator for a sharedsummary parameter
278 }else if (parameter == "sharedsummary") {
280 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
283 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
284 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
285 m->mothurOut(it->first + ", ");
287 m->mothurOutEndLine();
289 }else if (parameter == "sharedrarefaction") {
291 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
294 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
295 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
296 m->mothurOut(it->first + ", ");
298 m->mothurOutEndLine();
300 }else if (parameter == "vennsingle") {
302 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
305 m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
306 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
307 m->mothurOut(it->first + ", ");
309 m->mothurOutEndLine();
311 }else if (parameter == "vennshared") {
313 if ((vennshared.find(calculator)) != (vennshared.end())) {
316 m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
317 for (it = vennshared.begin(); it != vennshared.end(); it++) {
318 m->mothurOut(it->first + ", ");
320 m->mothurOutEndLine();
322 }else if (parameter == "treegroup") {
324 if ((treegroup.find(calculator)) != (treegroup.end())) {
327 m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
328 for (it = treegroup.begin(); it != treegroup.end(); it++) {
329 m->mothurOut(it->first + ", ");
331 m->mothurOutEndLine();
333 }else if (parameter == "matrix") {
335 if ((matrix.find(calculator)) != (matrix.end())) {
338 m->mothurOut(calculator + " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
339 for (it = matrix.begin(); it != matrix.end(); it++) {
340 m->mothurOut(it->first + ", ");
342 m->mothurOutEndLine();
344 }else if (parameter == "heat") {
346 if ((heat.find(calculator)) != (heat.end())) {
349 m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
350 for (it = heat.begin(); it != heat.end(); it++) {
351 m->mothurOut(it->first + ", ");
353 m->mothurOutEndLine();
355 }else if (parameter == "boot") {
357 if ((boot.find(calculator)) != (boot.end())) {
360 m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
361 for (it = boot.begin(); it != boot.end(); it++) {
362 m->mothurOut(it->first + ", ");
364 m->mothurOutEndLine();
366 }else if (parameter == "distance") {
368 if ((distance.find(calculator)) != (distance.end())) {
371 m->mothurOut(calculator + " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
372 for (it = distance.begin(); it != distance.end(); it++) {
373 m->mothurOut(it->first + ", ");
375 m->mothurOutEndLine();
377 //not a valid parameter
378 }else { return false; }
381 catch(exception& e) {
382 m->errorOut(e, "ValidCalculator", "isValidCalculator");
387 /********************************************************************/
388 void ValidCalculators::initialSingle() {
390 single["sobs"] = "sobs";
391 single["chao"] = "chao";
392 single["ace"] = "ace";
393 single["jack"] = "jack";
394 single["shannon"] = "shannon";
395 single["npshannon"] = "npshannon";
396 single["shannoneven"] = "shannoneven";
397 single["shannonrange"] = "shannonrange";
398 single["smithwilson"] = "smithwilson";
399 single["heip"] = "heip";
400 single["simpson"] = "simpson";
401 single["simpsoneven"] = "simpsoneven";
402 single["invsimpson"] = "invsimpson";
403 single["bergerparker"] = "bergerparker";
404 single["bootstrap"] = "bootstrap";
405 single["geometric"] = "geometric";
406 single["logseries"] = "logseries";
407 single["qstat"] = "qstat";
408 single["bstick"] = "bstick";
409 single["goodscoverage"] = "goodscoverage";
410 single["nseqs"] = "nseqs";
411 single["coverage"] = "coverage";
412 single["efron"] = "efron";
413 single["boneh"] = "boneh";
414 single["solow"] = "solow";
415 single["shen"] = "shen";
416 single["default"] = "default";
418 catch(exception& e) {
419 m->errorOut(e, "ValidCalculator", "initialSingle");
424 /********************************************************************/
425 void ValidCalculators::initialShared() {
427 shared["sharedsobs"] = "sharedsobs";
428 shared["sharedchao"] = "sharedchao";
429 shared["sharedace"] = "sharedace";
430 shared["jabund"] = "jabund";
431 shared["sorabund"] = "sorabund";
432 shared["jclass"] = "jclass";
433 shared["sorclass"] = "sorclass";
434 shared["jest"] = "jest";
435 shared["sorest"] = "sorest";
436 shared["thetayc"] = "thetayc";
437 shared["thetan"] = "thetan";
438 shared["kstest"] = "kstest";
439 shared["whittaker"] = "whittaker";
440 shared["sharednseqs"] = "sharednseqs";
441 shared["ochiai"] = "ochiai";
442 shared["anderberg"] = "anderberg";
443 shared["kulczynski"] = "kulczynski";
444 shared["kulczynskicody"] = "kulczynskicody";
445 shared["lennon"] = "lennon";
446 shared["morisitahorn"] = "morisitahorn";
447 shared["braycurtis"] = "braycurtis";
448 shared["odum"] = "odum";
449 shared["canberra"] = "canberra";
450 shared["structeuclidean"] = "structeuclidean";
451 shared["structchord"] = "structchord";
452 shared["hellinger"] = "hellinger";
453 shared["manhattan"] = "manhattan";
454 shared["structpearson"] = "structpearson";
455 shared["soergel"] = "soergel";
456 shared["spearman"] = "spearman";
457 shared["structkulczynski"] = "structkulczynski";
458 shared["structchi2"] = "structchi2";
459 shared["speciesprofile"] = "speciesprofile";
460 shared["hamming"] = "hamming";
461 shared["gower"] = "gower";
462 shared["memchi2"] = "memchi2";
463 shared["memchord"] = "memchord";
464 shared["memeuclidean"] = "memeuclidean";
465 shared["mempearson"] = "mempearson";
466 shared["jsd"] = "jsd";
467 shared["rjsd"] = "rjsd";
468 shared["default"] = "default";
470 catch(exception& e) {
471 m->errorOut(e, "ValidCalculator", "initialShared");
476 /********************************************************************/
477 void ValidCalculators::initialRarefaction() {
479 rarefaction["sobs"] = "sobs";
480 rarefaction["chao"] = "chao";
481 rarefaction["ace"] = "ace";
482 rarefaction["jack"] = "jack";
483 rarefaction["shannon"] = "shannon";
484 rarefaction["smithwilson"] = "smithwilson";
485 rarefaction["heip"] = "heip";
486 rarefaction["npshannon"] = "npshannon";
487 rarefaction["shannoneven"] = "shannoneven";
488 rarefaction["shannonrange"] = "shannonrange";
489 rarefaction["simpson"] = "simpson";
490 rarefaction["invsimpson"] = "invsimpson";
491 rarefaction["simpsoneven"] = "simpsoneven";
492 rarefaction["bootstrap"] = "bootstrap";
493 rarefaction["nseqs"] = "nseqs";
494 rarefaction["coverage"] = "coverage";
495 rarefaction["default"] = "default";
497 catch(exception& e) {
498 m->errorOut(e, "ValidCalculator", "initialRarefaction");
503 /********************************************************************/
505 void ValidCalculators::initialSummary() {
507 summary["sobs"] = "sobs";
508 summary["chao"] = "chao";
509 summary["ace"] = "ace";
510 summary["jack"] = "jack";
511 summary["shannon"] = "shannon";
512 summary["heip"] = "heip";
513 summary["shannoneven"] = "shannoneven";
514 summary["smithwilson"] = "smithwilson";
515 summary["invsimpson"] = "invsimpson";
516 summary["npshannon"] = "npshannon";
517 summary["shannonrange"] = "shannonrange";
518 summary["simpson"] = "simpson";
519 summary["simpsoneven"] = "simpsoneven";
520 summary["bergerparker"] = "bergerparker";
521 summary["geometric"] = "geometric";
522 summary["bootstrap"] = "bootstrap";
523 summary["logseries"] = "logseries";
524 summary["qstat"] = "qstat";
525 summary["bstick"] = "bstick";
526 summary["nseqs"] = "nseqs";
527 summary["goodscoverage"]= "goodscoverage";
528 summary["coverage"] = "coverage";
529 summary["efron"] = "efron";
530 summary["boneh"] = "boneh";
531 summary["solow"] = "solow";
532 summary["shen"] = "shen";
533 summary["default"] = "default";
535 catch(exception& e) {
536 m->errorOut(e, "ValidCalculator", "initialSummary");
541 /********************************************************************/
542 void ValidCalculators::initialSharedSummary() {
544 sharedsummary["sharedsobs"] = "sharedsobs";
545 sharedsummary["sharedchao"] = "sharedchao";
546 sharedsummary["sharedace"] = "sharedace";
547 sharedsummary["jabund"] = "jabund";
548 sharedsummary["sorabund"] = "sorabund";
549 sharedsummary["jclass"] = "jclass";
550 sharedsummary["sorclass"] = "sorclass";
551 sharedsummary["jest"] = "jest";
552 sharedsummary["sorest"] = "sorest";
553 sharedsummary["thetayc"] = "thetayc";
554 sharedsummary["thetan"] = "thetan";
555 sharedsummary["kstest"] = "kstest";
556 sharedsummary["whittaker"] = "whittaker";
557 sharedsummary["sharednseqs"] = "sharednseqs";
558 sharedsummary["ochiai"] = "ochiai";
559 sharedsummary["anderberg"] = "anderberg";
560 sharedsummary["kulczynski"] = "kulczynski";
561 sharedsummary["kulczynskicody"] = "kulczynskicody";
562 sharedsummary["lennon"] = "lennon";
563 sharedsummary["morisitahorn"] = "morisitahorn";
564 sharedsummary["braycurtis"] = "braycurtis";
565 sharedsummary["odum"] = "odum";
566 sharedsummary["canberra"] = "canberra";
567 sharedsummary["structeuclidean"] = "structeuclidean";
568 sharedsummary["structchord"] = "structchord";
569 sharedsummary["hellinger"] = "hellinger";
570 sharedsummary["manhattan"] = "manhattan";
571 sharedsummary["structpearson"] = "structpearson";
572 sharedsummary["structkulczynski"] = "structkulczynski";
573 sharedsummary["structchi2"] = "structchi2";
574 sharedsummary["soergel"] = "soergel";
575 sharedsummary["spearman"] = "spearman";
576 sharedsummary["speciesprofile"] = "speciesprofile";
577 sharedsummary["hamming"] = "hamming";
578 sharedsummary["gower"] = "gower";
579 sharedsummary["memchi2"] = "memchi2";
580 sharedsummary["memchord"] = "memchord";
581 sharedsummary["memeuclidean"] = "memeuclidean";
582 sharedsummary["mempearson"] = "mempearson";
583 sharedsummary["jsd"] = "jsd";
584 sharedsummary["rjsd"] = "rjsd";
585 sharedsummary["default"] = "default";
587 catch(exception& e) {
588 m->errorOut(e, "ValidCalculator", "initialSharedSummary");
594 /********************************************************************/
596 void ValidCalculators::initialSharedRarefact() {
598 sharedrarefaction["sharedobserved"] = "sharedobserved";
599 sharedrarefaction["sharednseqs"] = "sharednseqs";
600 sharedrarefaction["default"] = "default";
602 catch(exception& e) {
603 m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
609 /********************************************************************/
610 void ValidCalculators::initialVennSingle() {
612 vennsingle["sobs"] = "sobs";
613 vennsingle["chao"] = "chao";
614 vennsingle["ace"] = "ace";
615 vennsingle["jack"] = "jack";
616 vennsingle["default"] = "default";
618 catch(exception& e) {
619 m->errorOut(e, "ValidCalculator", "initialVennSingle");
624 /********************************************************************/
625 void ValidCalculators::initialVennShared() {
627 vennshared["sharedsobs"] = "sharedsobs";
628 vennshared["sharedchao"] = "sharedchao";
629 vennshared["sharedace"] = "sharedace";
630 vennshared["default"] = "default";
632 catch(exception& e) {
633 m->errorOut(e, "ValidCalculator", "initialVennShared");
638 /********************************************************************/
639 void ValidCalculators::initialTreeGroups() {
641 treegroup["sharedsobs"] = "sharedsobs";
642 treegroup["sharedchao"] = "sharedchao";
643 treegroup["sharedace"] = "sharedace";
644 treegroup["jabund"] = "jabund";
645 treegroup["sorabund"] = "sorabund";
646 treegroup["jclass"] = "jclass";
647 treegroup["sorclass"] = "sorclass";
648 treegroup["jest"] = "jest";
649 treegroup["sorest"] = "sorest";
650 treegroup["thetayc"] = "thetayc";
651 treegroup["thetan"] = "thetan";
652 treegroup["kstest"] = "kstest";
653 treegroup["whittaker"] = "whittaker";
654 treegroup["sharednseqs"] = "sharednseqs";
655 treegroup["ochiai"] = "ochiai";
656 treegroup["anderberg"] = "anderberg";
657 treegroup["kulczynski"] = "kulczynski";
658 treegroup["kulczynskicody"] = "kulczynskicody";
659 treegroup["lennon"] = "lennon";
660 treegroup["morisitahorn"] = "morisitahorn";
661 treegroup["braycurtis"] = "braycurtis";
662 treegroup["odum"] = "odum";
663 treegroup["canberra"] = "canberra";
664 treegroup["structeuclidean"] = "structeuclidean";
665 treegroup["structchord"] = "structchord";
666 treegroup["hellinger"] = "hellinger";
667 treegroup["manhattan"] = "manhattan";
668 treegroup["structpearson"] = "structpearson";
669 treegroup["structkulczynski"] = "structkulczynski";
670 treegroup["structchi2"] = "structchi2";
671 treegroup["soergel"] = "soergel";
672 treegroup["spearman"] = "spearman";
673 treegroup["speciesprofile"] = "speciesprofile";
674 treegroup["hamming"] = "hamming";
675 treegroup["gower"] = "gower";
676 treegroup["memchi2"] = "memchi2";
677 treegroup["memchord"] = "memchord";
678 treegroup["memeuclidean"] = "memeuclidean";
679 treegroup["mempearson"] = "mempearson";
682 catch(exception& e) {
683 m->errorOut(e, "ValidCalculator", "initialTreeGroups");
687 /********************************************************************/
688 void ValidCalculators::initialHeat() {
690 heat["jabund"] = "jabund";
691 heat["sorabund"] = "sorabund";
692 heat["jclass"] = "jclass";
693 heat["sorclass"] = "sorclass";
694 heat["jest"] = "jest";
695 heat["sorest"] = "sorest";
696 heat["thetayc"] = "thetayc";
697 heat["thetan"] = "thetan";
698 heat["morisitahorn"] = "morisitahorn";
699 heat["braycurtis"] = "braycurtis";
701 catch(exception& e) {
702 m->errorOut(e, "ValidCalculator", "initialHeat");
707 /********************************************************************/
708 void ValidCalculators::initialMatrix() {
710 matrix["sharedsobs"] = "sharedsobs";
711 matrix["sharedchao"] = "sharedchao";
712 matrix["sharedace"] = "sharedace";
713 matrix["jabund"] = "jabund";
714 matrix["sorabund"] = "sorabund";
715 matrix["jclass"] = "jclass";
716 matrix["sorclass"] = "sorclass";
717 matrix["jest"] = "jest";
718 matrix["sorest"] = "sorest";
719 matrix["thetayc"] = "thetayc";
720 matrix["thetan"] = "thetan";
721 matrix["kstest"] = "kstest";
722 matrix["whittaker"] = "whittaker";
723 matrix["sharednseqs"] = "sharednseqs";
724 matrix["ochiai"] = "ochiai";
725 matrix["anderberg"] = "anderberg";
726 matrix["kulczynski"] = "kulczynski";
727 matrix["kulczynskicody"] = "kulczynskicody";
728 matrix["lennon"] = "lennon";
729 matrix["morisitahorn"] = "morisitahorn";
730 matrix["braycurtis"] = "braycurtis";
731 matrix["odum"] = "odum";
732 matrix["canberra"] = "canberra";
733 matrix["structeuclidean"] = "structeuclidean";
734 matrix["structchord"] = "structchord";
735 matrix["hellinger"] = "hellinger";
736 matrix["manhattan"] = "manhattan";
737 matrix["structpearson"] = "structpearson";
738 matrix["structkulczynski"] = "structkulczynski";
739 matrix["structchi2"] = "structchi2";
740 matrix["soergel"] = "soergel";
741 matrix["spearman"] = "spearman";
742 matrix["speciesprofile"] = "speciesprofile";
743 matrix["hamming"] = "hamming";
744 matrix["gower"] = "gower";
745 matrix["memchi2"] = "memchi2";
746 matrix["memchord"] = "memchord";
747 matrix["memeuclidean"] = "memeuclidean";
748 matrix["mempearson"] = "mempearson";
749 matrix["rjsd"] = "rjsd";
750 matrix["jsd"] = "jsd";
753 catch(exception& e) {
754 m->errorOut(e, "ValidCalculator", "initialMatrix");
759 /********************************************************************/
760 void ValidCalculators::initialBoot() {
762 boot["jabund"] = "jabund";
763 boot["sorabund"] = "sorabund";
764 boot["jclass"] = "jclass";
765 boot["sorclass"] = "orclass";
766 boot["jest"] = "jest";
767 boot["sorest"] = "sorest";
768 boot["thetayc"] = "thetayc";
769 boot["thetan"] = "thetan";
770 boot["morisitahorn"] = "morisitahorn";
771 boot["braycurtis"] = "braycurtis";
773 catch(exception& e) {
774 m->errorOut(e, "ValidCalculator", "initialBoot");
778 /********************************************************************/
779 void ValidCalculators::initialDistance() {
781 distance["nogaps"] = "nogaps";
782 distance["eachgap"] = "eachgap";
783 distance["onegap"] = "onegap";
785 catch(exception& e) {
786 m->errorOut(e, "ValidCalculator", "initialDistance");
791 /********************************************************************/
792 void ValidCalculators::printCalc(string parameter, ostream& out) {
794 out << "The available estimators for calc are ";
795 //are you looking for a calculator for a single parameter
796 if (parameter == "single") {
797 for (it = single.begin(); it != single.end(); it++) {
798 out << it->first << ", ";
800 //are you looking for a calculator for a shared parameter
801 }else if (parameter == "shared") {
802 for (it = shared.begin(); it != shared.end(); it++) {
803 out << it->first << ", ";
805 //are you looking for a calculator for a rarefaction parameter
806 }else if (parameter == "rarefaction") {
807 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
808 out << it->first << ", ";
810 //are you looking for a calculator for a summary parameter
811 }else if (parameter == "summary") {
812 for (it = summary.begin(); it != summary.end(); it++) {
813 out << it->first << ", ";
815 //are you looking for a calculator for a sharedsummary parameter
816 }else if (parameter == "sharedsummary") {
817 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
818 out << it->first << ", ";
820 }else if (parameter == "sharedrarefaction") {
821 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
822 out << it->first << ", ";
824 }else if (parameter == "vennsingle") {
825 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
826 out << it->first << ", ";
828 }else if (parameter == "vennshared") {
829 for (it = vennshared.begin(); it != vennshared.end(); it++) {
830 out << it->first << ", ";
832 }else if (parameter == "treegroup") {
833 for (it = treegroup.begin(); it != treegroup.end(); it++) {
834 out << it->first << ", ";
836 }else if (parameter == "matrix") {
837 for (it = matrix.begin(); it != matrix.end(); it++) {
838 out << it->first << ", ";
840 }else if (parameter == "heat") {
841 for (it = heat.begin(); it != heat.end(); it++) {
842 out << it->first << ", ";
844 }else if (parameter == "boot") {
845 for (it = boot.begin(); it != boot.end(); it++) {
846 out << it->first << ", ";
848 }else if (parameter == "distance") {
849 for (it = distance.begin(); it != distance.end(); it++) {
850 out << it->first << ", ";
856 catch(exception& e) {
857 m->errorOut(e, "ValidCalculator", "printCalc");
861 /********************************************************************/
862 string ValidCalculators::printCalc(string parameter) {
864 string output = "The available estimators for calc are ";
865 //are you looking for a calculator for a single parameter
866 if (parameter == "single") {
867 for (it = single.begin(); it != single.end(); it++) {
868 output += it->first + ", ";
870 //are you looking for a calculator for a shared parameter
871 }else if (parameter == "shared") {
872 for (it = shared.begin(); it != shared.end(); it++) {
873 output += it->first + ", ";
875 //are you looking for a calculator for a rarefaction parameter
876 }else if (parameter == "rarefaction") {
877 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
878 output += it->first + ", ";
880 //are you looking for a calculator for a summary parameter
881 }else if (parameter == "summary") {
882 for (it = summary.begin(); it != summary.end(); it++) {
883 output += it->first + ", ";
885 //are you looking for a calculator for a sharedsummary parameter
886 }else if (parameter == "sharedsummary") {
887 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
888 output += it->first + ", ";
890 }else if (parameter == "sharedrarefaction") {
891 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
892 output += it->first + ", ";
894 }else if (parameter == "vennsingle") {
895 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
896 output += it->first + ", ";
898 }else if (parameter == "vennshared") {
899 for (it = vennshared.begin(); it != vennshared.end(); it++) {
900 output += it->first + ", ";
902 }else if (parameter == "treegroup") {
903 for (it = treegroup.begin(); it != treegroup.end(); it++) {
904 output += it->first + ", ";
906 }else if (parameter == "matrix") {
907 for (it = matrix.begin(); it != matrix.end(); it++) {
908 output += it->first + ", ";
910 }else if (parameter == "heat") {
911 for (it = heat.begin(); it != heat.end(); it++) {
912 output += it->first + ", ";
914 }else if (parameter == "boot") {
915 for (it = boot.begin(); it != boot.end(); it++) {
916 output += it->first + ", ";
918 }else if (parameter == "distance") {
919 for (it = distance.begin(); it != distance.end(); it++) {
920 output += it->first + ", ";
925 output = output.substr(0, output.length()-1);
930 catch(exception& e) {
931 m->errorOut(e, "ValidCalculator", "printCalc");
935 /********************************************************************/