]> git.donarmstrong.com Git - mothur.git/blob - validparameter.cpp
Initial revision
[mothur.git] / validparameter.cpp
1 /*
2  *  validparameter.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 "validparameter.h"
11
12 /***********************************************************************/
13
14 ValidParameters::ValidParameters() {
15         try {
16         
17                 parameters["distfile"]                  = "distfile"; 
18                 parameters["listfile"]                  = "listfile"; 
19                 parameters["rabundfile"]                = "rabundfile"; 
20                 parameters["sabundfile"]                = "sabundfile"; 
21                 parameters["namefile"]                  = "namefile"; 
22                 parameters["groupfile"]                 = "groupfile"; 
23                 parameters["orderfile"]                 = "orderfile"; 
24                 parameters["fileroot"]                  = "fileroot";
25                 parameters["cutoff"]                    = "cutoff"; 
26                 parameters["method"]                    = "method";
27                 parameters["format"]                    = "format"; 
28                 parameters["precision"]                 = "precision"; 
29                 parameters["label"]                             = "label"; 
30                 parameters["line"]                              = "line"; 
31                 parameters["iters"]                             = "iters"; 
32                 parameters["jumble"]                    = "jumble"; 
33                 parameters["freq"]                              = "freq"; 
34                 parameters["single"]                    = "single"; 
35                 parameters["rarefaction"]               = "rarefaction"; 
36                 parameters["sharedrarefaction"] = "sharedrarefaction";
37                 parameters["shared"]                    = "shared"; 
38                 parameters["summary"]                   = "summary"; 
39                 parameters["sharedsummary"]             = "sharedsummary";
40
41         }
42         catch(exception& e) {
43                 cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function ValidParameters. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
44                 exit(1);
45         }
46         catch(...) {
47                 cout << "An unknown error has occurred in the ValidParameters class function ValidParameters. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
48                 exit(1);
49         }       
50 }
51
52 /***********************************************************************/
53
54 ValidParameters::~ValidParameters() {}
55
56 /***********************************************************************/
57 bool ValidParameters::isValidParameter(string parameter) {
58         try {   
59         
60                 //is the parameter in the map
61                 if ((parameters.find(parameter)) != (parameters.end())) {
62                         return true;
63                 }else{
64                         cout << parameter << " is not a valid parameter in Mothur." << endl;
65                         return false;
66                 }
67                 
68         }
69         catch(exception& e) {
70                 cout << "Standard Error: " << e.what() << " has occurred in the ValidParameters class Function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
71                 exit(1);
72         }
73         catch(...) {
74                 cout << "An unknown error has occurred in the ValidParameters class function isValidParameter. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
75                 exit(1);
76         }
77 }
78
79 /***********************************************************************/