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