]> git.donarmstrong.com Git - mothur.git/blob - validcommands.cpp
added get.oturep command
[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["bin.seqs"]                    = "bin.seqs"; 
21                 commands["get.oturep"]                  = "get.oturep";
22                 commands["cluster"]                             = "cluster"; 
23                 commands["deconvolute"]                 = "deconvolute"; 
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                 commands["parsimony"]                   = "parsimony";
31                 commands["unifrac.weighted"]    = "unifrac.weighted"; 
32                 commands["unifrac.unweighted"]  = "unifrac.unweighted"; 
33                 commands["libshuff"]                    = "libshuff";
34                 commands["heatmap"]                             = "heatmap";
35                 commands["venn"]                                = "venn";
36                 commands["get.group"]           = "get.group";
37                 commands["get.label"]           = "get.label";
38                 commands["get.line"]            = "get.line";
39                 commands["help"]                                = "help"; 
40                 commands["quit"]                                = "quit"; 
41
42                                 
43         }
44         catch(exception& e) {
45                 cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
46                 exit(1);
47         }
48         catch(...) {
49                 cout << "An unknown error has occurred in the ValidCommands class function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
50                 exit(1);
51         }       
52 }
53
54 /***********************************************************************/
55
56 ValidCommands::~ValidCommands() {}
57
58 /***********************************************************************/
59 bool ValidCommands::isValidCommand(string command) {
60         try {   
61         
62                 //is the command in the map
63                 if ((commands.find(command)) != (commands.end())) {
64                         return true;
65                 }else{
66                         cout << command << " is not a valid command in Mothur.  Valid commands are ";
67                         for (it = commands.begin(); it != commands.end(); it++) {
68                                 cout << it->first << ", ";
69                         }
70                         cout << endl;
71                         return false;
72                 }
73                 
74         }
75         catch(exception& e) {
76                 cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
77                 exit(1);
78         }
79         catch(...) {
80                 cout << "An unknown error has occurred in the ValidCommands class function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
81                 exit(1);
82         }
83 }
84
85 /***********************************************************************/
86 void ValidCommands::printCommands(ostream& out) {
87         try {   
88                 out << "Valid commands are ";
89                 for (it = commands.begin(); it != commands.end(); it++) {
90                         out << it->first << ", ";
91                 }
92                 out << endl;
93         }
94         catch(exception& e) {
95                 cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
96                 exit(1);
97         }
98         catch(...) {
99                 cout << "An unknown error has occurred in the ValidCommands class function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
100                 exit(1);
101         }
102 }
103
104
105
106