]> git.donarmstrong.com Git - mothur.git/blob - validcalculator.cpp
removed read.dist, read.otu, read.tree and globaldata. added current to defaults...
[mothur.git] / validcalculator.cpp
1 /*
2  *  validcalculator.cpp
3  *  Dotur
4  *
5  *  Created by Sarah Westcott on 1/5/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "validcalculator.h"
11
12 /********************************************************************/
13 ValidCalculators::ValidCalculators() {
14         try {
15                  m = MothurOut::getInstance();
16                 
17                  initialSingle();
18                  initialShared();
19                  initialRarefaction();
20                  initialSharedRarefact();
21                  initialSummary();
22                  initialSharedSummary();
23                  initialVennSingle();
24                  initialVennShared();
25                  initialTreeGroups();
26                  initialBoot();
27                  initialDistance();
28                  initialMatrix();
29                  initialHeat();
30         }
31         catch(exception& e) {
32                 m->errorOut(e, "ValidCalculator", "ValidCalculator");
33                 exit(1);
34         }
35 }
36
37 /********************************************************************/
38
39 ValidCalculators::~ValidCalculators() {}
40
41 /********************************************************************/
42
43 bool ValidCalculators::isValidCalculator(string parameter, string calculator) {
44         try {   
45                 //are you looking for a calculator for a single parameter
46                 if (parameter == "single") {
47                         //is it valid
48                         if ((single.find(calculator)) != (single.end())) {
49                                 return true;
50                         }else { 
51                                 m->mothurOut(calculator + " is not a valid estimator for the collect.single command and will be disregarded. Valid estimators are ");
52                                 for (it = single.begin(); it != single.end(); it++) {
53                                         m->mothurOut(it->first + ", ");
54                                 }
55                                 m->mothurOutEndLine();
56                                 return false; }
57                 //are you looking for a calculator for a shared parameter
58                 }else if (parameter == "shared") {
59                         //is it valid
60                         if ((shared.find(calculator)) != (shared.end())) {
61                                 return true;
62                         }else { 
63                                 m->mothurOut(calculator +  " is not a valid estimator for the collect.shared command and will be disregarded.  Valid estimators are ");
64                                 for (it = shared.begin(); it != shared.end(); it++) {
65                                         m->mothurOut(it->first + ", ");
66                                 }
67                                 m->mothurOutEndLine();
68                                 return false; }
69                 //are you looking for a calculator for a rarefaction parameter
70                 }else if (parameter == "rarefaction") {
71                         //is it valid
72                         if ((rarefaction.find(calculator)) != (rarefaction.end())) {
73                                 return true;
74                         }else { 
75                                 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.single command and will be disregarded. Valid estimators are ");
76                                 for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
77                                         m->mothurOut(it->first + ", ");
78                                 }
79                                 m->mothurOutEndLine();
80                                 return false; }
81                 //are you looking for a calculator for a summary parameter
82                 }else if (parameter == "summary") {
83                         //is it valid
84                         if ((summary.find(calculator)) != (summary.end())) {
85                                 return true;
86                         }else { 
87                                 m->mothurOut(calculator + " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
88                                 for (it = summary.begin(); it != summary.end(); it++) {
89                                         m->mothurOut(it->first + ", ");
90                                 }
91                                 m->mothurOutEndLine();
92                                 return false; }
93                 //are you looking for a calculator for a sharedsummary parameter
94                 }else if (parameter == "sharedsummary") {
95                         //is it valid
96                         if ((sharedsummary.find(calculator)) != (sharedsummary.end())) {
97                                 return true;
98                         }else { 
99                                 m->mothurOut(calculator +  " is not a valid estimator for the summary.shared command and will be disregarded. Valid estimators are ");
100                                 for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
101                                         m->mothurOut(it->first + ", ");
102                                 }
103                                 m->mothurOutEndLine();
104                                 return false; }
105                 }else if (parameter == "sharedrarefaction") {
106                         //is it valid
107                         if ((sharedrarefaction.find(calculator)) != (sharedrarefaction.end())) {
108                                 return true;
109                         }else { 
110                                 m->mothurOut(calculator + " is not a valid estimator for the rarefaction.shared command and will be disregarded. Valid estimator is ");
111                                 for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
112                                         m->mothurOut(it->first + ", ");
113                                 }
114                                 m->mothurOutEndLine();
115                                 return false; }
116                 }else if (parameter == "vennsingle") {
117                         //is it valid
118                         if ((vennsingle.find(calculator)) != (vennsingle.end())) {
119                                 return true;
120                         }else { 
121                                 m->mothurOut(calculator + " is not a valid estimator for the venn command in single mode and will be disregarded. Valid estimators are ");
122                                 for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
123                                         m->mothurOut(it->first + ", ");
124                                 }
125                                 m->mothurOutEndLine();
126                                 return false; }
127                 }else if (parameter == "vennshared") {
128                         //is it valid
129                         if ((vennshared.find(calculator)) != (vennshared.end())) {
130                                 return true;
131                         }else { 
132                                 m->mothurOut(calculator + " is not a valid estimator for the venn command in shared mode and will be disregarded. Valid estimators are ");
133                                 for (it = vennshared.begin(); it != vennshared.end(); it++) {
134                                         m->mothurOut(it->first + ", ");
135                                 }
136                                 m->mothurOutEndLine();
137                                 return false; }
138                 }else if (parameter == "treegroup") {
139                         //is it valid
140                         if ((treegroup.find(calculator)) != (treegroup.end())) {
141                                 return true;
142                         }else { 
143                                 m->mothurOut(calculator + " is not a valid estimator for the tree.shared command and will be disregarded. Valid estimators are ");
144                                 for (it = treegroup.begin(); it != treegroup.end(); it++) {
145                                         m->mothurOut(it->first + ", ");
146                                 }
147                                 m->mothurOutEndLine();
148                                 return false; }
149                 }else if (parameter == "matrix") {
150                         //is it valid
151                         if ((matrix.find(calculator)) != (matrix.end())) {
152                                 return true;
153                         }else { 
154                                 m->mothurOut(calculator +  " is not a valid estimator for the matrix.output command and will be disregarded. Valid estimators are ");
155                                 for (it = matrix.begin(); it != matrix.end(); it++) {
156                                         m->mothurOut(it->first + ", ");
157                                 }
158                                 m->mothurOutEndLine();
159                                 return false; }
160                 }else if (parameter == "heat") {
161                         //is it valid
162                         if ((heat.find(calculator)) != (heat.end())) {
163                                 return true;
164                         }else { 
165                                 m->mothurOut(calculator + " is not a valid estimator for the heatmap.sim command and will be disregarded. Valid estimators are ");
166                                 for (it = heat.begin(); it != heat.end(); it++) {
167                                         m->mothurOut(it->first + ", ");
168                                 }
169                                 m->mothurOutEndLine();
170                                 return false; }
171                 }else if (parameter == "boot") {
172                         //is it valid
173                         if ((boot.find(calculator)) != (boot.end())) {
174                                 return true;
175                         }else { 
176                                 m->mothurOut(calculator + " is not a valid estimator for the bootstrap.shared command and will be disregarded. Valid estimators are ");
177                                 for (it = boot.begin(); it != boot.end(); it++) {
178                                         m->mothurOut(it->first + ", ");
179                                 }
180                                 m->mothurOutEndLine();
181                                 return false; }
182                 }else if (parameter == "distance") {
183                         //is it valid
184                         if ((distance.find(calculator)) != (distance.end())) {
185                                 return true;
186                         }else { 
187                                 m->mothurOut(calculator +  " is not a valid estimator for the distance command and will be disregarded. Valid calculators are ");
188                                 for (it = distance.begin(); it != distance.end(); it++) {
189                                         m->mothurOut(it->first + ", ");
190                                 }
191                                 m->mothurOutEndLine();
192                                 return false; }
193                 //not a valid parameter
194                 }else { return false; }
195                 
196         }
197         catch(exception& e) {
198                 m->errorOut(e, "ValidCalculator", "isValidCalculator");
199                 exit(1);
200         }
201 }
202
203 /********************************************************************/
204 void ValidCalculators::initialSingle() {
205         try {   
206                 single["sobs"]          = "sobs";
207                 single["chao"]              = "chao";
208                 single["ace"]               = "ace";
209                 single["jack"]              = "jack";
210                 single["shannon"]           = "shannon";
211                 single["npshannon"]     = "npshannon";
212                 single["shannoneven"]   = "shannoneven";
213                 single["smithwilson"]   = "smithwilson";
214                 single["heip"]                  = "heip";
215                 single["simpson"]           = "simpson";
216                 single["simpsoneven"]   = "simpsoneven";
217                 single["invsimpson"]    = "invsimpson";
218                 single["bergerparker"]  = "bergerparker";
219                 single["bootstrap"]     = "bootstrap";
220                 single["geometric"]     = "geometric";
221                 single["logseries"]             = "logseries";
222                 single["qstat"]         = "qstat";
223                 single["bstick"]        = "bstick";
224                 single["goodscoverage"] = "goodscoverage";
225                 single["nseqs"]                 = "nseqs";
226                 single["coverage"]              = "coverage";
227                 single["efron"]         = "efron";
228                 single["boneh"]         = "boneh";
229                 single["solow"]         = "solow";
230                 single["shen"]          = "shen";
231                 single["default"]           = "default";
232         }
233         catch(exception& e) {
234                 m->errorOut(e, "ValidCalculator", "initialSingle");
235                 exit(1);
236         }
237 }
238
239 /********************************************************************/
240 void ValidCalculators::initialShared() {
241         try {   
242                 shared["sharedsobs"]                    = "sharedsobs";
243                 shared["sharedchao"]                    = "sharedchao";
244                 shared["sharedace"]                             = "sharedace";
245                 shared["jabund"]                                = "jabund";
246                 shared["sorabund"]                              = "sorabund";
247                 shared["jclass"]                                = "jclass";
248                 shared["sorclass"]                              = "sorclass";
249                 shared["jest"]                                  = "jest";
250                 shared["sorest"]                                = "sorest";
251                 shared["thetayc"]                               = "thetayc";
252                 shared["thetan"]                                = "thetan";
253                 shared["kstest"]                                = "kstest";
254                 shared["whittaker"]                         = "whittaker";
255                 shared["sharednseqs"]                   = "sharednseqs";
256                 shared["ochiai"]                                = "ochiai";
257                 shared["anderberg"]                             = "anderberg";
258                 shared["kulczynski"]                    = "kulczynski";
259                 shared["kulczynskicody"]                = "kulczynskicody";
260                 shared["lennon"]                                = "lennon";
261                 shared["morisitahorn"]                  = "morisitahorn";
262                 shared["braycurtis"]                    = "braycurtis";
263                 shared["odum"]                                  = "odum";
264                 shared["canberra"]                              = "canberra";
265                 shared["structeuclidean"]               = "structeuclidean";
266                 shared["structchord"]                   = "structchord";
267                 shared["hellinger"]                             = "hellinger";
268                 shared["manhattan"]                             = "manhattan";
269                 shared["structpearson"]                 = "structpearson";
270                 shared["soergel"]                               = "soergel";
271                 shared["spearman"]                              = "spearman";
272                 shared["structkulczynski"]              = "structkulczynski";
273                 shared["structchi2"]                    = "structchi2";
274                 shared["speciesprofile"]                = "speciesprofile";
275                 shared["hamming"]                               = "hamming";
276                 shared["gower"]                                 = "gower";
277                 shared["memchi2"]                               = "memchi2";
278                 shared["memchord"]                              = "memchord";
279                 shared["memeuclidean"]                  = "memeuclidean";
280                 shared["mempearson"]                    = "mempearson";
281                 shared["default"]                   = "default";
282         }
283         catch(exception& e) {
284                 m->errorOut(e, "ValidCalculator", "initialShared");
285                 exit(1);
286         }
287 }
288
289 /********************************************************************/
290 void ValidCalculators::initialRarefaction() {
291         try {   
292                 rarefaction["sobs"]                     = "sobs";
293                 rarefaction["chao"]                     = "chao";
294                 rarefaction["ace"]                      = "ace";
295                 rarefaction["jack"]                     = "jack";
296                 rarefaction["shannon"]          = "shannon";
297                 rarefaction["smithwilson"]      = "smithwilson";
298                 rarefaction["heip"]                     = "heip";
299                 rarefaction["npshannon"]        = "npshannon";
300                 rarefaction["shannoneven"]      = "shannoneven";
301                 rarefaction["simpson"]          = "simpson";
302                 rarefaction["invsimpson"]       = "invsimpson";
303                 rarefaction["simpsoneven"]      = "simpsoneven";
304                 rarefaction["bootstrap"]        = "bootstrap";
305                 rarefaction["nseqs"]            = "nseqs";
306                 rarefaction["coverage"]         = "coverage";
307                 rarefaction["default"]      = "default";
308         }
309         catch(exception& e) {
310                 m->errorOut(e, "ValidCalculator", "initialRarefaction");
311                 exit(1);
312         }
313 }
314
315 /********************************************************************/
316
317 void ValidCalculators::initialSummary() {
318         try {   
319                 summary["sobs"]                 = "sobs";
320                 summary["chao"]                 = "chao";
321                 summary["ace"]                  = "ace";
322                 summary["jack"]                 = "jack";
323                 summary["shannon"]              = "shannon";
324                 summary["heip"]                 = "heip";
325                 summary["shannoneven"]  = "shannoneven";
326                 summary["smithwilson"]  = "smithwilson";
327                 summary["invsimpson"]   = "invsimpson";
328                 summary["npshannon"]    = "npshannon";
329                 summary["simpson"]              = "simpson";
330                 summary["simpsoneven"]  = "simpsoneven";
331                 summary["bergerparker"] = "bergerparker";
332                 summary["geometric"]    = "geometric";
333                 summary["bootstrap"]    = "bootstrap";
334                 summary["logseries"]    = "logseries";
335                 summary["qstat"]        = "qstat";
336                 summary["bstick"]       = "bstick";
337                 summary["nseqs"]                = "nseqs";
338                 summary["goodscoverage"]= "goodscoverage";
339                 summary["coverage"]             = "coverage";
340                 summary["efron"]        = "efron";
341                 summary["boneh"]        = "boneh";
342                 summary["solow"]        = "solow";
343                 summary["shen"]         = "shen";
344                 summary["default"]          = "default";
345         }
346         catch(exception& e) {
347                 m->errorOut(e, "ValidCalculator", "initialSummary");
348                 exit(1);
349         }
350 }
351
352 /********************************************************************/
353 void ValidCalculators::initialSharedSummary() {
354         try {   
355                 sharedsummary["sharedsobs"]                             = "sharedsobs";
356                 sharedsummary["sharedchao"]                             = "sharedchao";
357                 sharedsummary["sharedace"]                              = "sharedace";
358                 sharedsummary["jabund"]                                 = "jabund";
359                 sharedsummary["sorabund"]                               = "sorabund";
360                 sharedsummary["jclass"]                                 = "jclass";
361                 sharedsummary["sorclass"]                               = "sorclass";
362                 sharedsummary["jest"]                                   = "jest";
363                 sharedsummary["sorest"]                                 = "sorest";
364                 sharedsummary["thetayc"]                                = "thetayc";
365                 sharedsummary["thetan"]                                 = "thetan";
366                 sharedsummary["kstest"]                                 = "kstest";
367                 sharedsummary["whittaker"]                              = "whittaker";
368                 sharedsummary["sharednseqs"]                    = "sharednseqs";
369                 sharedsummary["ochiai"]                                 = "ochiai";
370                 sharedsummary["anderberg"]                              = "anderberg";
371                 sharedsummary["kulczynski"]                             = "kulczynski";
372                 sharedsummary["kulczynskicody"]                 = "kulczynskicody";
373                 sharedsummary["lennon"]                                 = "lennon";
374                 sharedsummary["morisitahorn"]                   = "morisitahorn";
375                 sharedsummary["braycurtis"]                             = "braycurtis";
376                 sharedsummary["odum"]                                   = "odum";
377                 sharedsummary["canberra"]                               = "canberra";
378                 sharedsummary["structeuclidean"]                = "structeuclidean";
379                 sharedsummary["structchord"]                    = "structchord";
380                 sharedsummary["hellinger"]                              = "hellinger";
381                 sharedsummary["manhattan"]                              = "manhattan";
382                 sharedsummary["structpearson"]                  = "structpearson";
383                 sharedsummary["structkulczynski"]               = "structkulczynski";
384                 sharedsummary["structchi2"]                             = "structchi2";
385                 sharedsummary["soergel"]                                = "soergel";
386                 sharedsummary["spearman"]                               = "spearman";
387                 sharedsummary["speciesprofile"]                 = "speciesprofile";
388                 sharedsummary["hamming"]                                = "hamming";
389                 sharedsummary["gower"]                                  = "gower";
390                 sharedsummary["memchi2"]                                = "memchi2";
391                 sharedsummary["memchord"]                               = "memchord";
392                 sharedsummary["memeuclidean"]                   = "memeuclidean";
393                 sharedsummary["mempearson"]                             = "mempearson";
394                 sharedsummary["default"]                                = "default";
395         }
396         catch(exception& e) {
397                 m->errorOut(e, "ValidCalculator", "initialSharedSummary");
398                 exit(1);
399         }
400 }
401
402
403 /********************************************************************/
404
405 void ValidCalculators::initialSharedRarefact() {
406         try {   
407                 sharedrarefaction["sharedobserved"]     = "sharedobserved";
408                 sharedrarefaction["sharednseqs"]        = "sharednseqs";
409                 sharedrarefaction["default"]        = "default";
410         }
411         catch(exception& e) {
412                 m->errorOut(e, "ValidCalculator", "initialSharedRarefact");
413                 exit(1);
414         }
415 }
416
417
418 /********************************************************************/
419 void ValidCalculators::initialVennSingle() {
420         try {
421                 vennsingle["sobs"]              = "sobs";
422                 vennsingle["chao"]                  = "chao";
423                 vennsingle["ace"]                       = "ace";
424                 vennsingle["jack"]                  = "jack";
425                 vennsingle["default"]           = "default";
426         }
427         catch(exception& e) {
428                 m->errorOut(e, "ValidCalculator", "initialVennSingle");
429                 exit(1);
430         }
431 }
432
433 /********************************************************************/
434 void ValidCalculators::initialVennShared() {
435         try {
436                 vennshared["sharedsobs"]        = "sharedsobs";
437                 vennshared["sharedchao"]        = "sharedchao";
438                 vennshared["sharedace"]         = "sharedace";
439                 vennshared["default"]           = "default";
440         }
441         catch(exception& e) {
442                 m->errorOut(e, "ValidCalculator", "initialVennShared");
443                 exit(1);
444         }
445 }
446
447 /********************************************************************/
448 void ValidCalculators::initialTreeGroups() {
449         try {   
450                 treegroup["sharedsobs"]                         = "sharedsobs";
451                 treegroup["sharedchao"]                         = "sharedchao";
452                 treegroup["sharedace"]                          = "sharedace";
453                 treegroup["jabund"]                                     = "jabund";
454                 treegroup["sorabund"]                           = "sorabund";
455                 treegroup["jclass"]                                     = "jclass";
456                 treegroup["sorclass"]                           = "sorclass";
457                 treegroup["jest"]                                       = "jest";
458                 treegroup["sorest"]                                     = "sorest";
459                 treegroup["thetayc"]                            = "thetayc";
460                 treegroup["thetan"]                                     = "thetan";
461                 treegroup["kstest"]                                     = "kstest";
462                 treegroup["whittaker"]                          = "whittaker";
463                 treegroup["sharednseqs"]                        = "sharednseqs";
464                 treegroup["ochiai"]                                     = "ochiai";
465                 treegroup["anderberg"]                          = "anderberg";
466                 treegroup["kulczynski"]                         = "kulczynski";
467                 treegroup["kulczynskicody"]                     = "kulczynskicody";
468                 treegroup["lennon"]                                     = "lennon";
469                 treegroup["morisitahorn"]                       = "morisitahorn";
470                 treegroup["braycurtis"]                         = "braycurtis";
471                 treegroup["odum"]                                       = "odum";
472                 treegroup["canberra"]                           = "canberra";
473                 treegroup["structeuclidean"]            = "structeuclidean";
474                 treegroup["structchord"]                        = "structchord";
475                 treegroup["hellinger"]                          = "hellinger";
476                 treegroup["manhattan"]                          = "manhattan";
477                 treegroup["structpearson"]                      = "structpearson";
478                 treegroup["structkulczynski"]           = "structkulczynski";
479                 treegroup["structchi2"]                         = "structchi2";
480                 treegroup["soergel"]                            = "soergel";
481                 treegroup["spearman"]                           = "spearman";
482                 treegroup["speciesprofile"]                     = "speciesprofile";
483                 treegroup["hamming"]                            = "hamming";
484                 treegroup["gower"]                                      = "gower";
485                 treegroup["memchi2"]                            = "memchi2";
486                 treegroup["memchord"]                           = "memchord";
487                 treegroup["memeuclidean"]                       = "memeuclidean";
488                 treegroup["mempearson"]                         = "mempearson";
489                 
490         }
491         catch(exception& e) {
492                 m->errorOut(e, "ValidCalculator", "initialTreeGroups");
493                 exit(1);
494         }
495 }
496 /********************************************************************/
497 void ValidCalculators::initialHeat() {
498         try {   
499                 heat["jabund"]                          = "jabund";
500                 heat["sorabund"]                        = "sorabund";
501                 heat["jclass"]                          = "jclass";
502                 heat["sorclass"]                        = "sorclass";
503                 heat["jest"]                            = "jest";
504                 heat["sorest"]                          = "sorest";
505                 heat["thetayc"]                         = "thetayc";
506                 heat["thetan"]                          = "thetan";
507                 heat["morisitahorn"]            = "morisitahorn";
508                 heat["braycurtis"]                      = "braycurtis";
509         }
510         catch(exception& e) {
511                 m->errorOut(e, "ValidCalculator", "initialHeat");
512                 exit(1);
513         }
514 }
515
516 /********************************************************************/
517 void ValidCalculators::initialMatrix() {
518         try {   
519                 matrix["sharedsobs"]                            = "sharedsobs";
520                 matrix["sharedchao"]                            = "sharedchao";
521                 matrix["sharedace"]                             = "sharedace";
522                 matrix["jabund"]                                        = "jabund";
523                 matrix["sorabund"]                              = "sorabund";
524                 matrix["jclass"]                                        = "jclass";
525                 matrix["sorclass"]                              = "sorclass";
526                 matrix["jest"]                                  = "jest";
527                 matrix["sorest"]                                        = "sorest";
528                 matrix["thetayc"]                               = "thetayc";
529                 matrix["thetan"]                                        = "thetan";
530                 matrix["kstest"]                                        = "kstest";
531                 matrix["whittaker"]                             = "whittaker";
532                 matrix["sharednseqs"]                   = "sharednseqs";
533                 matrix["ochiai"]                                        = "ochiai";
534                 matrix["anderberg"]                             = "anderberg";
535                 matrix["kulczynski"]                            = "kulczynski";
536                 matrix["kulczynskicody"]                        = "kulczynskicody";
537                 matrix["lennon"]                                        = "lennon";
538                 matrix["morisitahorn"]                  = "morisitahorn";
539                 matrix["braycurtis"]                            = "braycurtis";
540                 matrix["odum"]                                  = "odum";
541                 matrix["canberra"]                              = "canberra";
542                 matrix["structeuclidean"]               = "structeuclidean";
543                 matrix["structchord"]                   = "structchord";
544                 matrix["hellinger"]                             = "hellinger";
545                 matrix["manhattan"]                             = "manhattan";
546                 matrix["structpearson"]                 = "structpearson";
547                 matrix["structkulczynski"]              = "structkulczynski";
548                 matrix["structchi2"]                            = "structchi2";
549                 matrix["soergel"]                               = "soergel";
550                 matrix["spearman"]                              = "spearman";
551                 matrix["speciesprofile"]                        = "speciesprofile";
552                 matrix["hamming"]                               = "hamming";
553                 matrix["gower"]                                 = "gower";
554                 matrix["memchi2"]                               = "memchi2";
555                 matrix["memchord"]                              = "memchord";
556                 matrix["memeuclidean"]                  = "memeuclidean";
557                 matrix["mempearson"]                            = "mempearson";
558                 
559         }
560         catch(exception& e) {
561                 m->errorOut(e, "ValidCalculator", "initialMatrix");
562                 exit(1);
563         }
564 }
565
566 /********************************************************************/
567 void ValidCalculators::initialBoot() {
568         try {   
569                 boot["jabund"]                          = "jabund";
570                 boot["sorabund"]                        = "sorabund";
571                 boot["jclass"]                          = "jclass";
572                 boot["sorclass"]                        = "orclass";
573                 boot["jest"]                            = "jest";
574                 boot["sorest"]                          = "sorest";
575                 boot["thetayc"]                         = "thetayc";
576                 boot["thetan"]                          = "thetan";
577                 boot["morisitahorn"]            = "morisitahorn";
578                 boot["braycurtis"]                      = "braycurtis";
579         }
580         catch(exception& e) {
581                 m->errorOut(e, "ValidCalculator", "initialBoot");
582                 exit(1);
583         }
584 }
585 /********************************************************************/
586 void ValidCalculators::initialDistance() {
587         try {   
588                 distance["nogaps"]              = "nogaps";
589                 distance["eachgap"]             = "eachgap";
590                 distance["onegap"]              = "onegap";
591         }
592         catch(exception& e) {
593                 m->errorOut(e, "ValidCalculator", "initialDistance");
594                 exit(1);
595         }
596 }
597
598 /********************************************************************/
599 void ValidCalculators::printCalc(string parameter, ostream& out) {
600         try{
601                 out << "The available estimators for calc are ";
602                 //are you looking for a calculator for a single parameter
603                 if (parameter == "single") {
604                         for (it = single.begin(); it != single.end(); it++) {
605                                 out << it->first << ", ";
606                         }
607                 //are you looking for a calculator for a shared parameter
608                 }else if (parameter == "shared") {
609                         for (it = shared.begin(); it != shared.end(); it++) {
610                                 out << it->first << ", ";
611                         }
612                 //are you looking for a calculator for a rarefaction parameter
613                 }else if (parameter == "rarefaction") {
614                         for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
615                                 out << it->first << ", ";
616                         }
617                 //are you looking for a calculator for a summary parameter
618                 }else if (parameter == "summary") {
619                         for (it = summary.begin(); it != summary.end(); it++) {
620                                 out << it->first << ", ";
621                         }
622                 //are you looking for a calculator for a sharedsummary parameter
623                 }else if (parameter == "sharedsummary") {
624                         for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
625                                 out << it->first << ", ";
626                         }
627                 }else if (parameter == "sharedrarefaction") {
628                         for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
629                                 out << it->first << ", ";
630                         }
631                 }else if (parameter == "vennsingle") {
632                         for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
633                                 out << it->first << ", ";
634                         }
635                 }else if (parameter == "vennshared") {
636                         for (it = vennshared.begin(); it != vennshared.end(); it++) {
637                                 out << it->first << ", ";
638                         }
639                 }else if (parameter == "treegroup") {
640                         for (it = treegroup.begin(); it != treegroup.end(); it++) {
641                                 out << it->first << ", ";
642                         }
643                 }else if (parameter == "matrix") {
644                         for (it = matrix.begin(); it != matrix.end(); it++) {
645                                 out << it->first << ", ";
646                         }
647                 }else if (parameter == "heat") {
648                         for (it = heat.begin(); it != heat.end(); it++) {
649                                 out << it->first << ", ";
650                         }
651                 }else if (parameter == "boot") {
652                         for (it = boot.begin(); it != boot.end(); it++) {
653                                 out << it->first << ", ";
654                         }
655                 }else if (parameter == "distance") {
656                         for (it = distance.begin(); it != distance.end(); it++) {
657                                 out << it->first << ", ";
658                         }
659                 }
660
661                 out << endl;
662         }
663         catch(exception& e) {
664                 m->errorOut(e, "ValidCalculator", "printCalc");
665                 exit(1);
666         }
667 }
668 /********************************************************************/
669 string ValidCalculators::printCalc(string parameter) {
670         try{
671                 string output = "The available estimators for calc are ";
672                 //are you looking for a calculator for a single parameter
673                 if (parameter == "single") {
674                         for (it = single.begin(); it != single.end(); it++) {
675                                 output += it->first + ", ";
676                         }
677                         //are you looking for a calculator for a shared parameter
678                 }else if (parameter == "shared") {
679                         for (it = shared.begin(); it != shared.end(); it++) {
680                                 output += it->first + ", ";
681                         }
682                         //are you looking for a calculator for a rarefaction parameter
683                 }else if (parameter == "rarefaction") {
684                         for (it = rarefaction.begin(); it != rarefaction.end(); it++) {
685                                 output += it->first + ", ";
686                         }
687                         //are you looking for a calculator for a summary parameter
688                 }else if (parameter == "summary") {
689                         for (it = summary.begin(); it != summary.end(); it++) {
690                                 output += it->first + ", ";
691                         }
692                         //are you looking for a calculator for a sharedsummary parameter
693                 }else if (parameter == "sharedsummary") {
694                         for (it = sharedsummary.begin(); it != sharedsummary.end(); it++) {
695                                 output += it->first + ", ";
696                         }
697                 }else if (parameter == "sharedrarefaction") {
698                         for (it = sharedrarefaction.begin(); it != sharedrarefaction.end(); it++) {
699                                 output += it->first + ", ";
700                         }
701                 }else if (parameter == "vennsingle") {
702                         for (it = vennsingle.begin(); it != vennsingle.end(); it++) {
703                                 output += it->first + ", ";
704                         }
705                 }else if (parameter == "vennshared") {
706                         for (it = vennshared.begin(); it != vennshared.end(); it++) {
707                                 output += it->first + ", ";
708                         }
709                 }else if (parameter == "treegroup") {
710                         for (it = treegroup.begin(); it != treegroup.end(); it++) {
711                                 output += it->first + ", ";
712                         }
713                 }else if (parameter == "matrix") {
714                         for (it = matrix.begin(); it != matrix.end(); it++) {
715                                 output += it->first + ", ";
716                         }
717                 }else if (parameter == "heat") {
718                         for (it = heat.begin(); it != heat.end(); it++) {
719                                 output += it->first + ", ";
720                         }
721                 }else if (parameter == "boot") {
722                         for (it = boot.begin(); it != boot.end(); it++) {
723                                 output += it->first + ", ";
724                         }
725                 }else if (parameter == "distance") {
726                         for (it = distance.begin(); it != distance.end(); it++) {
727                                 output += it->first + ", ";
728                         }
729                 }
730                 
731                 //rip off comma
732                 output = output.substr(0, output.length()-1);
733                 output += "\n";
734                 
735                 return output;
736         }
737         catch(exception& e) {
738                 m->errorOut(e, "ValidCalculator", "printCalc");
739                 exit(1);
740         }
741 }
742 /********************************************************************/
743
744