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"
81 /********************************************************************/
82 ValidCalculators::ValidCalculators() {
84 m = MothurOut::getInstance();
89 initialSharedRarefact();
91 initialSharedSummary();
100 for(it = single.begin(); it != single.end(); it++) { allCalcs.insert(it->first); }
101 for(it = shared.begin(); it != shared.end(); it++) { allCalcs.insert(it->first); }
102 for(it = rarefaction.begin(); it != rarefaction.end(); it++) { allCalcs.insert(it->first); }
103 for(it = summary.begin(); it != summary.end(); it++) { allCalcs.insert(it->first); }
104 for(it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) { allCalcs.insert(it->first); }
105 for(it = sharedsummary.begin(); it != sharedsummary.end(); it++) { allCalcs.insert(it->first); }
106 for(it = vennsingle.begin(); it != vennsingle.end(); it++) { allCalcs.insert(it->first); }
107 for(it = vennshared.begin(); it != vennshared.end(); it++) { allCalcs.insert(it->first); }
108 for(it = treegroup.begin(); it != treegroup.end(); it++) { allCalcs.insert(it->first); }
109 for(it = matrix.begin(); it != matrix.end(); it++) { allCalcs.insert(it->first); }
110 for(it = heat.begin(); it != heat.end(); it++) { allCalcs.insert(it->first); }
111 for(it = boot.begin(); it != boot.end(); it++) { allCalcs.insert(it->first); }
112 for(it = distance.begin(); it != distance.end(); it++) { allCalcs.insert(it->first); }
115 catch(exception& e) {
116 m->errorOut(e, "ValidCalculator", "ValidCalculator");
120 /********************************************************************/
121 ValidCalculators::~ValidCalculators() {}
122 /********************************************************************/
123 void ValidCalculators::printCitations(vector<string> Estimators) {
126 for (int i = 0; i < Estimators.size(); i++) {
127 //is this citation, do nothing
128 if ((Estimators[i] == "citation") || (Estimators[i] == "default") || (Estimators[i] == "eachgap") || (Estimators[i] == "nogaps") || (Estimators[i] == "onegap")) {}
129 //is this a valid calculator
130 else if (allCalcs.count(Estimators[i]) != 0) {
131 if (Estimators[i] == "sobs") { Calculator* temp = new Sobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
132 }else if (Estimators[i] == "chao") { Calculator* temp = new Chao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
133 }else if (Estimators[i] == "nseqs") { Calculator* temp = new NSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
134 }else if (Estimators[i] == "coverage") { Calculator* temp = new Coverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
135 }else if (Estimators[i] == "ace") { Calculator* temp = new Ace(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
137 }else if (Estimators[i] == "jack") { Calculator* temp = new Jackknife(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
138 }else if (Estimators[i] == "shannon") { Calculator* temp = new Shannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
139 }else if (Estimators[i] == "shannoneven") { Calculator* temp = new ShannonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
140 }else if (Estimators[i] == "npshannon") { Calculator* temp = new NPShannon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
141 }else if (Estimators[i] == "heip") { Calculator* temp = new Heip(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
143 }else if (Estimators[i] == "smithwilson") { Calculator* temp = new SmithWilson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
144 }else if (Estimators[i] == "simpson") { Calculator* temp = new Simpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
145 }else if (Estimators[i] == "simpsoneven") { Calculator* temp = new SimpsonEven(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
146 }else if (Estimators[i] == "invsimpson") { Calculator* temp = new InvSimpson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
147 }else if (Estimators[i] == "bootstrap") { Calculator* temp = new Bootstrap(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
149 }else if (Estimators[i] == "geometric") { Calculator* temp = new Geom(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
150 }else if (Estimators[i] == "qstat") { Calculator* temp = new QStat(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
151 }else if (Estimators[i] == "logseries") { Calculator* temp = new LogSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
152 }else if (Estimators[i] == "bergerparker") { Calculator* temp = new BergerParker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
153 }else if (Estimators[i] == "bstick") { Calculator* temp = new BStick(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
155 }else if (Estimators[i] == "goodscoverage") { Calculator* temp = new GoodsCoverage(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
156 }else if (Estimators[i] == "efron") { Calculator* temp = new Efron(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
157 }else if (Estimators[i] == "boneh") { Calculator* temp = new Boneh(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
158 }else if (Estimators[i] == "solow") { Calculator* temp = new Solow(10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
159 }else if (Estimators[i] == "shen") { Calculator* temp = new Shen(10, 10); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
161 }else if (Estimators[i] == "sharedchao") { Calculator* temp = new SharedChao1(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
162 }else if (Estimators[i] == "sharedsobs") { Calculator* temp = new SharedSobsCS(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
163 }else if (Estimators[i] == "sharedace") { Calculator* temp = new SharedAce(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
164 }else if (Estimators[i] == "jabund") { Calculator* temp = new JAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
165 }else if (Estimators[i] == "sorabund") { Calculator* temp = new SorAbund(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
167 }else if (Estimators[i] == "jclass") { Calculator* temp = new Jclass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
168 }else if (Estimators[i] == "sorclass") { Calculator* temp = new SorClass(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
169 }else if (Estimators[i] == "jest") { Calculator* temp = new Jest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
170 }else if (Estimators[i] == "sorest") { Calculator* temp = new SorEst(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
171 }else if (Estimators[i] == "thetayc") { Calculator* temp = new ThetaYC(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
173 }else if (Estimators[i] == "thetan") { Calculator* temp = new ThetaN(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
174 }else if (Estimators[i] == "kstest") { Calculator* temp = new KSTest(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
175 }else if (Estimators[i] == "whittaker") { Calculator* temp = new Whittaker(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
176 }else if (Estimators[i] == "sharednseqs") { Calculator* temp = new SharedNSeqs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
177 }else if (Estimators[i] == "ochiai") { Calculator* temp = new Ochiai(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
179 }else if (Estimators[i] == "anderberg") { Calculator* temp = new Anderberg(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
180 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
181 }else if (Estimators[i] == "kulczynskicody") { Calculator* temp = new KulczynskiCody(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
182 }else if (Estimators[i] == "lennon") { Calculator* temp = new Lennon(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
183 }else if (Estimators[i] == "morisitahorn") { Calculator* temp = new MorHorn(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
185 }else if (Estimators[i] == "braycurtis") { Calculator* temp = new BrayCurtis(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
186 }else if (Estimators[i] == "odum") { Calculator* temp = new Odum(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
187 }else if (Estimators[i] == "canberra") { Calculator* temp = new Canberra(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
188 }else if (Estimators[i] == "structeuclidean") { Calculator* temp = new StructEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
189 }else if (Estimators[i] == "structchord") { Calculator* temp = new StructChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
191 }else if (Estimators[i] == "hellinger") { Calculator* temp = new Hellinger(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
192 }else if (Estimators[i] == "manhattan") { Calculator* temp = new Manhattan(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
193 }else if (Estimators[i] == "structpearson") { Calculator* temp = new StructPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
194 }else if (Estimators[i] == "soergel") { Calculator* temp = new Soergel(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
195 }else if (Estimators[i] == "spearman") { Calculator* temp = new Spearman(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
197 }else if (Estimators[i] == "structkulczynski") { Calculator* temp = new StructKulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
198 }else if (Estimators[i] == "speciesprofile") { Calculator* temp = new SpeciesProfile(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
199 }else if (Estimators[i] == "hamming") { Calculator* temp = new Hamming(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
200 }else if (Estimators[i] == "structchi2") { Calculator* temp = new StructChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
201 }else if (Estimators[i] == "gower") { Calculator* temp = new Gower(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
203 }else if (Estimators[i] == "memchi2") { Calculator* temp = new MemChi2(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
204 }else if (Estimators[i] == "memchord") { Calculator* temp = new MemChord(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
205 }else if (Estimators[i] == "memeuclidean") { Calculator* temp = new MemEuclidean(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
206 }else if (Estimators[i] == "mempearson") { Calculator* temp = new MemPearson(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
207 }else if (Estimators[i] == "sharedobserved") { Calculator* temp = new SharedSobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
208 }else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
209 }else { m->mothurOut("[ERROR]: Missing else if for " + Estimators[i] + " in printCitations."); m->mothurOutEndLine(); }
210 }else { m->mothurOut(Estimators[i] + " is not a valid calculator, no citation will be given."); m->mothurOutEndLine(); }
214 catch(exception& e) {
215 m->errorOut(e, "ValidCalculator", "printCitations");
219 /********************************************************************/
221 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
223 //are you looking for a calculator for a single parameter
224 if (parameter == "single") {
226 if ((single.find(calculator)) != (single.end())) {
229 m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
230 for (it = single.begin(); it != single.end(); it++) {
231 m->mothurOut(it->first + ", ");
233 m->mothurOutEndLine();
235 //are you looking for a calculator for a shared parameter
236 }else if (parameter == "shared") {
238 if ((shared.find(calculator)) != (shared.end())) {
241 m->mothurOut(calculator + " is not a valid estimator for the collect.shared command and will be disregarded. Valid estimators are ");
242 for (it = shared.begin(); it != shared.end(); it++) {
243 m->mothurOut(it->first + ", ");
245 m->mothurOutEndLine();
247 //are you looking for a calculator for a rarefaction parameter
248 }else if (parameter == "rarefaction") {
250 if ((rarefaction.find(calculator)) != (rarefaction.end())) {
253 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
254 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
255 m->mothurOut(it->first + ", ");
257 m->mothurOutEndLine();
259 //are you looking for a calculator for a summary parameter
260 }else if (parameter == "summary") {
262 if ((summary.find(calculator)) != (summary.end())) {
265 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
266 for (it = summary.begin(); it != summary.end(); it++) {
267 m->mothurOut(it->first + ", ");
269 m->mothurOutEndLine();
271 //are you looking for a calculator for a sharedsummary parameter
272 }else if (parameter == "sharedsummary") {
274 if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
277 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
278 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
279 m->mothurOut(it->first + ", ");
281 m->mothurOutEndLine();
283 }else if (parameter == "sharedrarefaction") {
285 if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
288 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
289 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
290 m->mothurOut(it->first + ", ");
292 m->mothurOutEndLine();
294 }else if (parameter == "vennsingle") {
296 if ((vennsingle.find(calculator)) != (vennsingle.end())) {
299 m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
300 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
301 m->mothurOut(it->first + ", ");
303 m->mothurOutEndLine();
305 }else if (parameter == "vennshared") {
307 if ((vennshared.find(calculator)) != (vennshared.end())) {
310 m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
311 for (it = vennshared.begin(); it != vennshared.end(); it++) {
312 m->mothurOut(it->first + ", ");
314 m->mothurOutEndLine();
316 }else if (parameter == "treegroup") {
318 if ((treegroup.find(calculator)) != (treegroup.end())) {
321 m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
322 for (it = treegroup.begin(); it != treegroup.end(); it++) {
323 m->mothurOut(it->first + ", ");
325 m->mothurOutEndLine();
327 }else if (parameter == "matrix") {
329 if ((matrix.find(calculator)) != (matrix.end())) {
332 m->mothurOut(calculator + " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
333 for (it = matrix.begin(); it != matrix.end(); it++) {
334 m->mothurOut(it->first + ", ");
336 m->mothurOutEndLine();
338 }else if (parameter == "heat") {
340 if ((heat.find(calculator)) != (heat.end())) {
343 m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
344 for (it = heat.begin(); it != heat.end(); it++) {
345 m->mothurOut(it->first + ", ");
347 m->mothurOutEndLine();
349 }else if (parameter == "boot") {
351 if ((boot.find(calculator)) != (boot.end())) {
354 m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
355 for (it = boot.begin(); it != boot.end(); it++) {
356 m->mothurOut(it->first + ", ");
358 m->mothurOutEndLine();
360 }else if (parameter == "distance") {
362 if ((distance.find(calculator)) != (distance.end())) {
365 m->mothurOut(calculator + " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
366 for (it = distance.begin(); it != distance.end(); it++) {
367 m->mothurOut(it->first + ", ");
369 m->mothurOutEndLine();
371 //not a valid parameter
372 }else { return false; }
375 catch(exception& e) {
376 m->errorOut(e, "ValidCalculator", "isValidCalculator");
381 /********************************************************************/
382 void ValidCalculators::initialSingle() {
384 single["sobs"] = "sobs";
385 single["chao"] = "chao";
386 single["ace"] = "ace";
387 single["jack"] = "jack";
388 single["shannon"] = "shannon";
389 single["npshannon"] = "npshannon";
390 single["shannoneven"] = "shannoneven";
391 single["smithwilson"] = "smithwilson";
392 single["heip"] = "heip";
393 single["simpson"] = "simpson";
394 single["simpsoneven"] = "simpsoneven";
395 single["invsimpson"] = "invsimpson";
396 single["bergerparker"] = "bergerparker";
397 single["bootstrap"] = "bootstrap";
398 single["geometric"] = "geometric";
399 single["logseries"] = "logseries";
400 single["qstat"] = "qstat";
401 single["bstick"] = "bstick";
402 single["goodscoverage"] = "goodscoverage";
403 single["nseqs"] = "nseqs";
404 single["coverage"] = "coverage";
405 single["efron"] = "efron";
406 single["boneh"] = "boneh";
407 single["solow"] = "solow";
408 single["shen"] = "shen";
409 single["default"] = "default";
411 catch(exception& e) {
412 m->errorOut(e, "ValidCalculator", "initialSingle");
417 /********************************************************************/
418 void ValidCalculators::initialShared() {
420 shared["sharedsobs"] = "sharedsobs";
421 shared["sharedchao"] = "sharedchao";
422 shared["sharedace"] = "sharedace";
423 shared["jabund"] = "jabund";
424 shared["sorabund"] = "sorabund";
425 shared["jclass"] = "jclass";
426 shared["sorclass"] = "sorclass";
427 shared["jest"] = "jest";
428 shared["sorest"] = "sorest";
429 shared["thetayc"] = "thetayc";
430 shared["thetan"] = "thetan";
431 shared["kstest"] = "kstest";
432 shared["whittaker"] = "whittaker";
433 shared["sharednseqs"] = "sharednseqs";
434 shared["ochiai"] = "ochiai";
435 shared["anderberg"] = "anderberg";
436 shared["kulczynski"] = "kulczynski";
437 shared["kulczynskicody"] = "kulczynskicody";
438 shared["lennon"] = "lennon";
439 shared["morisitahorn"] = "morisitahorn";
440 shared["braycurtis"] = "braycurtis";
441 shared["odum"] = "odum";
442 shared["canberra"] = "canberra";
443 shared["structeuclidean"] = "structeuclidean";
444 shared["structchord"] = "structchord";
445 shared["hellinger"] = "hellinger";
446 shared["manhattan"] = "manhattan";
447 shared["structpearson"] = "structpearson";
448 shared["soergel"] = "soergel";
449 shared["spearman"] = "spearman";
450 shared["structkulczynski"] = "structkulczynski";
451 shared["structchi2"] = "structchi2";
452 shared["speciesprofile"] = "speciesprofile";
453 shared["hamming"] = "hamming";
454 shared["gower"] = "gower";
455 shared["memchi2"] = "memchi2";
456 shared["memchord"] = "memchord";
457 shared["memeuclidean"] = "memeuclidean";
458 shared["mempearson"] = "mempearson";
459 shared["default"] = "default";
461 catch(exception& e) {
462 m->errorOut(e, "ValidCalculator", "initialShared");
467 /********************************************************************/
468 void ValidCalculators::initialRarefaction() {
470 rarefaction["sobs"] = "sobs";
471 rarefaction["chao"] = "chao";
472 rarefaction["ace"] = "ace";
473 rarefaction["jack"] = "jack";
474 rarefaction["shannon"] = "shannon";
475 rarefaction["smithwilson"] = "smithwilson";
476 rarefaction["heip"] = "heip";
477 rarefaction["npshannon"] = "npshannon";
478 rarefaction["shannoneven"] = "shannoneven";
479 rarefaction["simpson"] = "simpson";
480 rarefaction["invsimpson"] = "invsimpson";
481 rarefaction["simpsoneven"] = "simpsoneven";
482 rarefaction["bootstrap"] = "bootstrap";
483 rarefaction["nseqs"] = "nseqs";
484 rarefaction["coverage"] = "coverage";
485 rarefaction["default"] = "default";
487 catch(exception& e) {
488 m->errorOut(e, "ValidCalculator", "initialRarefaction");
493 /********************************************************************/
495 void ValidCalculators::initialSummary() {
497 summary["sobs"] = "sobs";
498 summary["chao"] = "chao";
499 summary["ace"] = "ace";
500 summary["jack"] = "jack";
501 summary["shannon"] = "shannon";
502 summary["heip"] = "heip";
503 summary["shannoneven"] = "shannoneven";
504 summary["smithwilson"] = "smithwilson";
505 summary["invsimpson"] = "invsimpson";
506 summary["npshannon"] = "npshannon";
507 summary["simpson"] = "simpson";
508 summary["simpsoneven"] = "simpsoneven";
509 summary["bergerparker"] = "bergerparker";
510 summary["geometric"] = "geometric";
511 summary["bootstrap"] = "bootstrap";
512 summary["logseries"] = "logseries";
513 summary["qstat"] = "qstat";
514 summary["bstick"] = "bstick";
515 summary["nseqs"] = "nseqs";
516 summary["goodscoverage"]= "goodscoverage";
517 summary["coverage"] = "coverage";
518 summary["efron"] = "efron";
519 summary["boneh"] = "boneh";
520 summary["solow"] = "solow";
521 summary["shen"] = "shen";
522 summary["default"] = "default";
524 catch(exception& e) {
525 m->errorOut(e, "ValidCalculator", "initialSummary");
530 /********************************************************************/
531 void ValidCalculators::initialSharedSummary() {
533 sharedsummary["sharedsobs"] = "sharedsobs";
534 sharedsummary["sharedchao"] = "sharedchao";
535 sharedsummary["sharedace"] = "sharedace";
536 sharedsummary["jabund"] = "jabund";
537 sharedsummary["sorabund"] = "sorabund";
538 sharedsummary["jclass"] = "jclass";
539 sharedsummary["sorclass"] = "sorclass";
540 sharedsummary["jest"] = "jest";
541 sharedsummary["sorest"] = "sorest";
542 sharedsummary["thetayc"] = "thetayc";
543 sharedsummary["thetan"] = "thetan";
544 sharedsummary["kstest"] = "kstest";
545 sharedsummary["whittaker"] = "whittaker";
546 sharedsummary["sharednseqs"] = "sharednseqs";
547 sharedsummary["ochiai"] = "ochiai";
548 sharedsummary["anderberg"] = "anderberg";
549 sharedsummary["kulczynski"] = "kulczynski";
550 sharedsummary["kulczynskicody"] = "kulczynskicody";
551 sharedsummary["lennon"] = "lennon";
552 sharedsummary["morisitahorn"] = "morisitahorn";
553 sharedsummary["braycurtis"] = "braycurtis";
554 sharedsummary["odum"] = "odum";
555 sharedsummary["canberra"] = "canberra";
556 sharedsummary["structeuclidean"] = "structeuclidean";
557 sharedsummary["structchord"] = "structchord";
558 sharedsummary["hellinger"] = "hellinger";
559 sharedsummary["manhattan"] = "manhattan";
560 sharedsummary["structpearson"] = "structpearson";
561 sharedsummary["structkulczynski"] = "structkulczynski";
562 sharedsummary["structchi2"] = "structchi2";
563 sharedsummary["soergel"] = "soergel";
564 sharedsummary["spearman"] = "spearman";
565 sharedsummary["speciesprofile"] = "speciesprofile";
566 sharedsummary["hamming"] = "hamming";
567 sharedsummary["gower"] = "gower";
568 sharedsummary["memchi2"] = "memchi2";
569 sharedsummary["memchord"] = "memchord";
570 sharedsummary["memeuclidean"] = "memeuclidean";
571 sharedsummary["mempearson"] = "mempearson";
572 sharedsummary["default"] = "default";
574 catch(exception& e) {
575 m->errorOut(e, "ValidCalculator", "initialSharedSummary");
581 /********************************************************************/
583 void ValidCalculators::initialSharedRarefact() {
585 sharedrarefaction["sharedobserved"] = "sharedobserved";
586 sharedrarefaction["sharednseqs"] = "sharednseqs";
587 sharedrarefaction["default"] = "default";
589 catch(exception& e) {
590 m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
596 /********************************************************************/
597 void ValidCalculators::initialVennSingle() {
599 vennsingle["sobs"] = "sobs";
600 vennsingle["chao"] = "chao";
601 vennsingle["ace"] = "ace";
602 vennsingle["jack"] = "jack";
603 vennsingle["default"] = "default";
605 catch(exception& e) {
606 m->errorOut(e, "ValidCalculator", "initialVennSingle");
611 /********************************************************************/
612 void ValidCalculators::initialVennShared() {
614 vennshared["sharedsobs"] = "sharedsobs";
615 vennshared["sharedchao"] = "sharedchao";
616 vennshared["sharedace"] = "sharedace";
617 vennshared["default"] = "default";
619 catch(exception& e) {
620 m->errorOut(e, "ValidCalculator", "initialVennShared");
625 /********************************************************************/
626 void ValidCalculators::initialTreeGroups() {
628 treegroup["sharedsobs"] = "sharedsobs";
629 treegroup["sharedchao"] = "sharedchao";
630 treegroup["sharedace"] = "sharedace";
631 treegroup["jabund"] = "jabund";
632 treegroup["sorabund"] = "sorabund";
633 treegroup["jclass"] = "jclass";
634 treegroup["sorclass"] = "sorclass";
635 treegroup["jest"] = "jest";
636 treegroup["sorest"] = "sorest";
637 treegroup["thetayc"] = "thetayc";
638 treegroup["thetan"] = "thetan";
639 treegroup["kstest"] = "kstest";
640 treegroup["whittaker"] = "whittaker";
641 treegroup["sharednseqs"] = "sharednseqs";
642 treegroup["ochiai"] = "ochiai";
643 treegroup["anderberg"] = "anderberg";
644 treegroup["kulczynski"] = "kulczynski";
645 treegroup["kulczynskicody"] = "kulczynskicody";
646 treegroup["lennon"] = "lennon";
647 treegroup["morisitahorn"] = "morisitahorn";
648 treegroup["braycurtis"] = "braycurtis";
649 treegroup["odum"] = "odum";
650 treegroup["canberra"] = "canberra";
651 treegroup["structeuclidean"] = "structeuclidean";
652 treegroup["structchord"] = "structchord";
653 treegroup["hellinger"] = "hellinger";
654 treegroup["manhattan"] = "manhattan";
655 treegroup["structpearson"] = "structpearson";
656 treegroup["structkulczynski"] = "structkulczynski";
657 treegroup["structchi2"] = "structchi2";
658 treegroup["soergel"] = "soergel";
659 treegroup["spearman"] = "spearman";
660 treegroup["speciesprofile"] = "speciesprofile";
661 treegroup["hamming"] = "hamming";
662 treegroup["gower"] = "gower";
663 treegroup["memchi2"] = "memchi2";
664 treegroup["memchord"] = "memchord";
665 treegroup["memeuclidean"] = "memeuclidean";
666 treegroup["mempearson"] = "mempearson";
669 catch(exception& e) {
670 m->errorOut(e, "ValidCalculator", "initialTreeGroups");
674 /********************************************************************/
675 void ValidCalculators::initialHeat() {
677 heat["jabund"] = "jabund";
678 heat["sorabund"] = "sorabund";
679 heat["jclass"] = "jclass";
680 heat["sorclass"] = "sorclass";
681 heat["jest"] = "jest";
682 heat["sorest"] = "sorest";
683 heat["thetayc"] = "thetayc";
684 heat["thetan"] = "thetan";
685 heat["morisitahorn"] = "morisitahorn";
686 heat["braycurtis"] = "braycurtis";
688 catch(exception& e) {
689 m->errorOut(e, "ValidCalculator", "initialHeat");
694 /********************************************************************/
695 void ValidCalculators::initialMatrix() {
697 matrix["sharedsobs"] = "sharedsobs";
698 matrix["sharedchao"] = "sharedchao";
699 matrix["sharedace"] = "sharedace";
700 matrix["jabund"] = "jabund";
701 matrix["sorabund"] = "sorabund";
702 matrix["jclass"] = "jclass";
703 matrix["sorclass"] = "sorclass";
704 matrix["jest"] = "jest";
705 matrix["sorest"] = "sorest";
706 matrix["thetayc"] = "thetayc";
707 matrix["thetan"] = "thetan";
708 matrix["kstest"] = "kstest";
709 matrix["whittaker"] = "whittaker";
710 matrix["sharednseqs"] = "sharednseqs";
711 matrix["ochiai"] = "ochiai";
712 matrix["anderberg"] = "anderberg";
713 matrix["kulczynski"] = "kulczynski";
714 matrix["kulczynskicody"] = "kulczynskicody";
715 matrix["lennon"] = "lennon";
716 matrix["morisitahorn"] = "morisitahorn";
717 matrix["braycurtis"] = "braycurtis";
718 matrix["odum"] = "odum";
719 matrix["canberra"] = "canberra";
720 matrix["structeuclidean"] = "structeuclidean";
721 matrix["structchord"] = "structchord";
722 matrix["hellinger"] = "hellinger";
723 matrix["manhattan"] = "manhattan";
724 matrix["structpearson"] = "structpearson";
725 matrix["structkulczynski"] = "structkulczynski";
726 matrix["structchi2"] = "structchi2";
727 matrix["soergel"] = "soergel";
728 matrix["spearman"] = "spearman";
729 matrix["speciesprofile"] = "speciesprofile";
730 matrix["hamming"] = "hamming";
731 matrix["gower"] = "gower";
732 matrix["memchi2"] = "memchi2";
733 matrix["memchord"] = "memchord";
734 matrix["memeuclidean"] = "memeuclidean";
735 matrix["mempearson"] = "mempearson";
738 catch(exception& e) {
739 m->errorOut(e, "ValidCalculator", "initialMatrix");
744 /********************************************************************/
745 void ValidCalculators::initialBoot() {
747 boot["jabund"] = "jabund";
748 boot["sorabund"] = "sorabund";
749 boot["jclass"] = "jclass";
750 boot["sorclass"] = "orclass";
751 boot["jest"] = "jest";
752 boot["sorest"] = "sorest";
753 boot["thetayc"] = "thetayc";
754 boot["thetan"] = "thetan";
755 boot["morisitahorn"] = "morisitahorn";
756 boot["braycurtis"] = "braycurtis";
758 catch(exception& e) {
759 m->errorOut(e, "ValidCalculator", "initialBoot");
763 /********************************************************************/
764 void ValidCalculators::initialDistance() {
766 distance["nogaps"] = "nogaps";
767 distance["eachgap"] = "eachgap";
768 distance["onegap"] = "onegap";
770 catch(exception& e) {
771 m->errorOut(e, "ValidCalculator", "initialDistance");
776 /********************************************************************/
777 void ValidCalculators::printCalc(string parameter, ostream& out) {
779 out << "The available estimators for calc are ";
780 //are you looking for a calculator for a single parameter
781 if (parameter == "single") {
782 for (it = single.begin(); it != single.end(); it++) {
783 out << it->first << ", ";
785 //are you looking for a calculator for a shared parameter
786 }else if (parameter == "shared") {
787 for (it = shared.begin(); it != shared.end(); it++) {
788 out << it->first << ", ";
790 //are you looking for a calculator for a rarefaction parameter
791 }else if (parameter == "rarefaction") {
792 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
793 out << it->first << ", ";
795 //are you looking for a calculator for a summary parameter
796 }else if (parameter == "summary") {
797 for (it = summary.begin(); it != summary.end(); it++) {
798 out << it->first << ", ";
800 //are you looking for a calculator for a sharedsummary parameter
801 }else if (parameter == "sharedsummary") {
802 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
803 out << it->first << ", ";
805 }else if (parameter == "sharedrarefaction") {
806 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
807 out << it->first << ", ";
809 }else if (parameter == "vennsingle") {
810 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
811 out << it->first << ", ";
813 }else if (parameter == "vennshared") {
814 for (it = vennshared.begin(); it != vennshared.end(); it++) {
815 out << it->first << ", ";
817 }else if (parameter == "treegroup") {
818 for (it = treegroup.begin(); it != treegroup.end(); it++) {
819 out << it->first << ", ";
821 }else if (parameter == "matrix") {
822 for (it = matrix.begin(); it != matrix.end(); it++) {
823 out << it->first << ", ";
825 }else if (parameter == "heat") {
826 for (it = heat.begin(); it != heat.end(); it++) {
827 out << it->first << ", ";
829 }else if (parameter == "boot") {
830 for (it = boot.begin(); it != boot.end(); it++) {
831 out << it->first << ", ";
833 }else if (parameter == "distance") {
834 for (it = distance.begin(); it != distance.end(); it++) {
835 out << it->first << ", ";
841 catch(exception& e) {
842 m->errorOut(e, "ValidCalculator", "printCalc");
846 /********************************************************************/
847 string ValidCalculators::printCalc(string parameter) {
849 string output = "The available estimators for calc are ";
850 //are you looking for a calculator for a single parameter
851 if (parameter == "single") {
852 for (it = single.begin(); it != single.end(); it++) {
853 output += it->first + ", ";
855 //are you looking for a calculator for a shared parameter
856 }else if (parameter == "shared") {
857 for (it = shared.begin(); it != shared.end(); it++) {
858 output += it->first + ", ";
860 //are you looking for a calculator for a rarefaction parameter
861 }else if (parameter == "rarefaction") {
862 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
863 output += it->first + ", ";
865 //are you looking for a calculator for a summary parameter
866 }else if (parameter == "summary") {
867 for (it = summary.begin(); it != summary.end(); it++) {
868 output += it->first + ", ";
870 //are you looking for a calculator for a sharedsummary parameter
871 }else if (parameter == "sharedsummary") {
872 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
873 output += it->first + ", ";
875 }else if (parameter == "sharedrarefaction") {
876 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
877 output += it->first + ", ";
879 }else if (parameter == "vennsingle") {
880 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
881 output += it->first + ", ";
883 }else if (parameter == "vennshared") {
884 for (it = vennshared.begin(); it != vennshared.end(); it++) {
885 output += it->first + ", ";
887 }else if (parameter == "treegroup") {
888 for (it = treegroup.begin(); it != treegroup.end(); it++) {
889 output += it->first + ", ";
891 }else if (parameter == "matrix") {
892 for (it = matrix.begin(); it != matrix.end(); it++) {
893 output += it->first + ", ";
895 }else if (parameter == "heat") {
896 for (it = heat.begin(); it != heat.end(); it++) {
897 output += it->first + ", ";
899 }else if (parameter == "boot") {
900 for (it = boot.begin(); it != boot.end(); it++) {
901 output += it->first + ", ";
903 }else if (parameter == "distance") {
904 for (it = distance.begin(); it != distance.end(); it++) {
905 output += it->first + ", ";
910 output = output.substr(0, output.length()-1);
915 catch(exception& e) {
916 m->errorOut(e, "ValidCalculator", "printCalc");
920 /********************************************************************/