]> git.donarmstrong.com Git - mothur.git/blob - validcommands.cpp
53ee7431b49fecc06002e5b9330259371bd35729
[mothur.git] / validcommands.cpp
1 /*
2  *  validcommands.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 "validcommands.h"
11
12 /***********************************************************************/
13
14 ValidCommands::ValidCommands() {
15         try {
16         
17                 commands["read.dist"]                   = "read.dist"; 
18                 commands["read.otu"]                    = "read.otu";
19                 commands["read.tree"]                   = "read.tree"; 
20                 commands["cluster"]                             = "cluster"; 
21                 commands["deconvolute"]                 = "deconvolute"; 
22                 commands["parsimony"]                   = "parsimony";
23                 commands["help"]                                = "help"; 
24                 commands["quit"]                                = "quit"; 
25                 commands["collect.single"]              = "collect.single"; 
26                 commands["collect.shared"]              = "collect.shared"; 
27                 commands["rarefaction.single"]  = "rarefaction.single"; 
28                 commands["rarefaction.shared"]  = "rarefaction.shared"; 
29                 commands["summary.single"]              = "summary.single"; 
30                 commands["summary.shared"]              = "summary.shared"; 
31                 commands["unifrac.weighted"]    = "unifrac.weighted"; 
32                 commands["unifrac.unweighted"]  = "unifrac.unweighted"; 
33
34                                 
35         }
36         catch(exception& e) {
37                 cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
38                 exit(1);
39         }
40         catch(...) {
41                 cout << "An unknown error has occurred in the ValidCommands class function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
42                 exit(1);
43         }       
44 }
45
46 /***********************************************************************/
47
48 ValidCommands::~ValidCommands() {}
49
50 /***********************************************************************/
51 bool ValidCommands::isValidCommand(string command) {
52         try {   
53         
54                 //is the command in the map
55                 if ((commands.find(command)) != (commands.end())) {
56                         return true;
57                 }else{
58                         cout << command << " is not a valid command in Mothur.  Valid commands are read.dist(), read.otu(), read.tree(), cluster(), deconvolute(), collect.single(), collect.shared(), rarefaction.single(), rarefaction.shared(), summary.single(), summary.shared(), parsimony(), unifrac.weighted(), unifrac.unweighted(), quit(), help()." << endl;
59                         return false;
60                 }
61                 
62         }
63         catch(exception& e) {
64                 cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
65                 exit(1);
66         }
67         catch(...) {
68                 cout << "An unknown error has occurred in the ValidCommands class function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
69                 exit(1);
70         }
71 }
72
73 /***********************************************************************/