37D9289B0F21331F001D4494 /* summarysharedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9284A0F21331F001D4494 /* summarysharedcommand.cpp */; };
37D9289C0F21331F001D4494 /* uvest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9284D0F21331F001D4494 /* uvest.cpp */; };
37D9289D0F21331F001D4494 /* validcalculator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D9284F0F21331F001D4494 /* validcalculator.cpp */; };
- 37D9289E0F21331F001D4494 /* validcommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928510F21331F001D4494 /* validcommands.cpp */; };
37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928530F21331F001D4494 /* validparameter.cpp */; };
37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F3E20F29FD4200F8D827 /* treenode.cpp */; };
37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */; };
37D9284E0F21331F001D4494 /* uvest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uvest.h; sourceTree = SOURCE_ROOT; };
37D9284F0F21331F001D4494 /* validcalculator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = validcalculator.cpp; sourceTree = SOURCE_ROOT; };
37D928500F21331F001D4494 /* validcalculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validcalculator.h; sourceTree = SOURCE_ROOT; };
- 37D928510F21331F001D4494 /* validcommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = validcommands.cpp; sourceTree = SOURCE_ROOT; };
- 37D928520F21331F001D4494 /* validcommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validcommands.h; sourceTree = SOURCE_ROOT; };
37D928530F21331F001D4494 /* validparameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = validparameter.cpp; sourceTree = SOURCE_ROOT; };
37D928540F21331F001D4494 /* validparameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = validparameter.h; sourceTree = SOURCE_ROOT; };
37E3ED800F4D9D0D00B5DF02 /* mothur.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mothur.h; sourceTree = SOURCE_ROOT; };
children = (
37D928500F21331F001D4494 /* validcalculator.h */,
37D9284F0F21331F001D4494 /* validcalculator.cpp */,
- 37D928520F21331F001D4494 /* validcommands.h */,
- 37D928510F21331F001D4494 /* validcommands.cpp */,
37D928540F21331F001D4494 /* validparameter.h */,
37D928530F21331F001D4494 /* validparameter.cpp */,
);
37D9289B0F21331F001D4494 /* summarysharedcommand.cpp in Sources */,
37D9289C0F21331F001D4494 /* uvest.cpp in Sources */,
37D9289D0F21331F001D4494 /* validcalculator.cpp in Sources */,
- 37D9289E0F21331F001D4494 /* validcommands.cpp in Sources */,
37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */,
372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */,
372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */,
CommandFactory::CommandFactory(){
string s = "";
command = new NoCommand(s);
+
+
+ //initialize list of valid commands
+ commands["read.dist"] = "read.dist";
+ commands["read.otu"] = "read.otu";
+ commands["read.tree"] = "read.tree";
+ commands["bin.seqs"] = "bin.seqs";
+ commands["get.oturep"] = "get.oturep";
+ commands["cluster"] = "cluster";
+ commands["unique.seqs"] = "unique.seqs";
+ commands["dist.seqs"] = "dist.seqs";
+ commands["dist.shared"] = "dist.shared";
+ commands["collect.single"] = "collect.single";
+ commands["collect.shared"] = "collect.shared";
+ commands["rarefaction.single"] = "rarefaction.single";
+ commands["rarefaction.shared"] = "rarefaction.shared";
+ commands["summary.single"] = "summary.single";
+ commands["summary.shared"] = "summary.shared";
+ commands["parsimony"] = "parsimony";
+ commands["unifrac.weighted"] = "unifrac.weighted";
+ commands["unifrac.unweighted"] = "unifrac.unweighted";
+ commands["libshuff"] = "libshuff";
+ commands["tree.shared"] = "tree.shared";
+ commands["heatmap.bin"] = "heatmap.bin";
+ commands["heatmap.sim"] = "heatmap.sim";
+ commands["venn"] = "venn";
+ commands["get.group"] = "get.group";
+ commands["get.label"] = "get.label";
+ commands["get.line"] = "get.line";
+ commands["get.sabund"] = "get.sabund";
+ commands["get.rabund"] = "get.rabund";
+ commands["bootstrap.shared"] = "bootstrap.shared";
+ commands["concensus"] = "concensus";
+ commands["help"] = "help";
+ commands["filter.seqs"] = "filter.seqs";
+ commands["align.seqs"] = "align.seqs";
+ commands["summary.seqs"] = "summary.seqs";
+ commands["screen.seqs"] = "screen.seqs";
+ commands["reverse.seqs"] = "reverse.seqs";
+ commands["trim.seqs"] = "trim.seqs";
+ commands["quit"] = "quit";
+
}
/***********************************************************/
}
}
-/***********************************************************/
+
+/***********************************************************************/
+bool CommandFactory::isValidCommand(string command) {
+ try {
+
+ //is the command in the map
+ if ((commands.find(command)) != (commands.end())) {
+ return true;
+ }else{
+ cout << command << " is not a valid command in Mothur. Valid commands are ";
+ for (it = commands.begin(); it != commands.end(); it++) {
+ cout << it->first << ", ";
+ }
+ cout << endl;
+ return false;
+ }
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the CommandFactory class function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/***********************************************************************/
+void CommandFactory::printCommands(ostream& out) {
+ try {
+ out << "Valid commands are ";
+ for (it = commands.begin(); it != commands.end(); it++) {
+ out << it->first << ", ";
+ }
+ out << endl;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the CommandFactory class function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+/***********************************************************************/
+
+
+
CommandFactory();
~CommandFactory();
Command* getCommand(string, string);
+ bool isValidCommand(string);
+ void printCommands(ostream&);
+
private:
Command* command;
+ map<string, string> commands;
+ map<string, string>::iterator it;
+
+
};
//**********************************************************************************************************************
HelpCommand::HelpCommand(string option){
+
+
+ if (option != "") { cout << "There are no valid parameters for the help() command." << endl; }
- if (option != "") { cout << "There are no valid parameters for the help() command." << endl; }
- validCommands = new ValidCommands();
+ validCommands = new CommandFactory();
}
//**********************************************************************************************************************
/* This class is designed to aid the user in running mothur. */
#include "command.hpp"
-#include "validcommands.h"
-
+#include "commandfactory.hpp"
class HelpCommand : public Command {
void help() {};
private:
- ValidCommands* validCommands;
+ CommandFactory* validCommands;
private:
*/
#include "nocommands.h"
-#include "validcommands.h"
//**********************************************************************************************************************
//Could choose to give more help here?fdsah
cout << "Invalid command." << "\n";
- ValidCommands* valid = new ValidCommands();
+ CommandFactory* valid = new CommandFactory();
valid->printCommands(cout);
delete valid;
/* This command is run if the user enters an invalid command. */
#include "command.hpp"
+#include "commandfactory.hpp"
class NoCommand : public Command {
+++ /dev/null
-/*
- * validcommands.cpp
- * Dotur
- *
- * Created by Sarah Westcott on 1/5/09.
- * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "validcommands.h"
-
-/***********************************************************************/
-
-ValidCommands::ValidCommands() {
- try {
-
- commands["read.dist"] = "read.dist";
- commands["read.otu"] = "read.otu";
- commands["read.tree"] = "read.tree";
- commands["bin.seqs"] = "bin.seqs";
- commands["get.oturep"] = "get.oturep";
- commands["cluster"] = "cluster";
- commands["unique.seqs"] = "unique.seqs";
- commands["dist.seqs"] = "dist.seqs";
- commands["dist.shared"] = "dist.shared";
- commands["collect.single"] = "collect.single";
- commands["collect.shared"] = "collect.shared";
- commands["rarefaction.single"] = "rarefaction.single";
- commands["rarefaction.shared"] = "rarefaction.shared";
- commands["summary.single"] = "summary.single";
- commands["summary.shared"] = "summary.shared";
- commands["parsimony"] = "parsimony";
- commands["unifrac.weighted"] = "unifrac.weighted";
- commands["unifrac.unweighted"] = "unifrac.unweighted";
- commands["libshuff"] = "libshuff";
- commands["tree.shared"] = "tree.shared";
- commands["heatmap.bin"] = "heatmap.bin";
- commands["heatmap.sim"] = "heatmap.sim";
- commands["venn"] = "venn";
- commands["get.group"] = "get.group";
- commands["get.label"] = "get.label";
- commands["get.line"] = "get.line";
- commands["get.sabund"] = "get.sabund";
- commands["get.rabund"] = "get.rabund";
- commands["bootstrap.shared"] = "bootstrap.shared";
- commands["concensus"] = "concensus";
- commands["help"] = "help";
- commands["filter.seqs"] = "filter.seqs";
- commands["align.seqs"] = "align.seqs";
- commands["summary.seqs"] = "summary.seqs";
- commands["screen.seqs"] = "screen.seqs";
- commands["reverse.seqs"] = "reverse.seqs";
- commands["trim.seqs"] = "trim.seqs";
- commands["quit"] = "quit";
-
-
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidCommands class function ValidCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-
-/***********************************************************************/
-
-ValidCommands::~ValidCommands() {}
-
-/***********************************************************************/
-bool ValidCommands::isValidCommand(string command) {
- try {
-
- //is the command in the map
- if ((commands.find(command)) != (commands.end())) {
- return true;
- }else{
- cout << command << " is not a valid command in Mothur. Valid commands are ";
- for (it = commands.begin(); it != commands.end(); it++) {
- cout << it->first << ", ";
- }
- cout << endl;
- return false;
- }
-
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidCommands class function isValidCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-
-/***********************************************************************/
-void ValidCommands::printCommands(ostream& out) {
- try {
- out << "Valid commands are ";
- for (it = commands.begin(); it != commands.end(); it++) {
- out << it->first << ", ";
- }
- out << endl;
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the ValidCommands class Function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the ValidCommands class function printCommands. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-}
-
-
-
-
+++ /dev/null
-#ifndef VALIDCOMMANDS_H
-#define VALIDCOMMANDS_H
-
-/*
- * validcommands.h
- * Dotur
- *
- * Created by Sarah Westcott on 1/5/09.
- * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
- *
- */
-
-#include "mothur.h"
-
-//This class contains a list of all valid commands in Mothur.
-//It has a function which will tell you if your command is valid.
-//When adding a new command you must add it to the valid list in the class constructor.
-
-class ValidCommands {
-
- public:
- ValidCommands();
- ~ValidCommands();
- bool isValidCommand(string);
- void printCommands(ostream&);
- private:
- map<string, string> commands;
- map<string, string>::iterator it;
-
-};
-
-#endif