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