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