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