#include "binsequencecommand.h"
#include "getoturepcommand.h"
#include "treegroupscommand.h"
-#include "bootstrapsharedcommand.h"
-//#include "consensuscommand.h"
#include "distancecommand.h"
#include "aligncommand.h"
#include "matrixoutputcommand.h"
commands["get.label"] = "get.label";
commands["get.sabund"] = "get.sabund";
commands["get.rabund"] = "get.rabund";
- commands["bootstrap.shared"] = "bootstrap.shared";
- //commands["consensus"] = "consensus";
commands["help"] = "help";
commands["reverse.seqs"] = "reverse.seqs";
commands["trim.seqs"] = "trim.seqs";
delete shellcommand;
delete pipecommand;
}
+/***********************************************************/
+/***********************************************************/
+int CommandFactory::checkForRedirects(string optionString) {
+ try {
+
+ int pos = optionString.find("outputdir");
+ if (pos != string::npos) { //user has set outputdir in command option string
+ string outputOption = "";
+ bool foundEquals = false;
+ for(int i=pos;i<optionString.length();i++){
+ if(optionString[i] == ',') { break; }
+ else if(optionString[i] == '=') { foundEquals = true; }
+ if (foundEquals) { outputOption += optionString[i]; }
+ }
+ if(m->dirCheck(outputOption)){
+ setOutputDirectory(outputOption);
+ m->mothurOut("Setting output directory to: " + outputOption); m->mothurOutEndLine();
+ }
+ }
+
+ pos = optionString.find("inputdir");
+ if (pos != string::npos) { //user has set inputdir in command option string
+ string intputOption = "";
+ bool foundEquals = false;
+ for(int i=pos;i<optionString.length();i++){
+ if(optionString[i] == ',') { break; }
+ else if(optionString[i] == '=') { foundEquals = true; }
+ if (foundEquals) { intputOption += optionString[i]; }
+ }
+ if(m->dirCheck(intputOption)){
+ setInputDirectory(intputOption);
+ m->mothurOut("Setting input directory to: " + intputOption); m->mothurOutEndLine();
+ }
+ }
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "CommandFactory", "getCommand");
+ exit(1);
+ }
+}
/***********************************************************/
/***********************************************************/
try {
delete command; //delete the old command
-
+
+ checkForRedirects(optionString);
+
//user has opted to redirect output from dir where input files are located to some other place
if (outputDir != "") {
if (optionString != "") { optionString += ", outputdir=" + outputDir; }
else if(commandName == "get.oturep") { command = new GetOTURepCommand(optionString); }
else if(commandName == "tree.shared") { command = new TreeGroupCommand(optionString); }
else if(commandName == "dist.shared") { command = new MatrixOutputCommand(optionString); }
- else if(commandName == "bootstrap.shared") { command = new BootSharedCommand(optionString); }
- else if(commandName == "consensus") { command = new ConcensusCommand(optionString); }
else if(commandName == "dist.seqs") { command = new DistanceCommand(optionString); }
else if(commandName == "align.seqs") { command = new AlignCommand(optionString); }
else if(commandName == "summary.seqs") { command = new SeqSummaryCommand(optionString); }
try {
delete pipecommand; //delete the old command
+ checkForRedirects(optionString);
+
//user has opted to redirect output from dir where input files are located to some other place
if (outputDir != "") {
if (optionString != "") { optionString += ", outputdir=" + outputDir; }
else if(commandName == "get.oturep") { pipecommand = new GetOTURepCommand(optionString); }
else if(commandName == "tree.shared") { pipecommand = new TreeGroupCommand(optionString); }
else if(commandName == "dist.shared") { pipecommand = new MatrixOutputCommand(optionString); }
- else if(commandName == "bootstrap.shared") { pipecommand = new BootSharedCommand(optionString); }
- else if(commandName == "consensus") { pipecommand = new ConcensusCommand(optionString); }
else if(commandName == "dist.seqs") { pipecommand = new DistanceCommand(optionString); }
else if(commandName == "align.seqs") { pipecommand = new AlignCommand(optionString); }
else if(commandName == "summary.seqs") { pipecommand = new SeqSummaryCommand(optionString); }
else if(commandName == "get.oturep") { shellcommand = new GetOTURepCommand(); }
else if(commandName == "tree.shared") { shellcommand = new TreeGroupCommand(); }
else if(commandName == "dist.shared") { shellcommand = new MatrixOutputCommand(); }
- else if(commandName == "bootstrap.shared") { shellcommand = new BootSharedCommand(); }
- else if(commandName == "consensus") { shellcommand = new ConcensusCommand(); }
else if(commandName == "dist.seqs") { shellcommand = new DistanceCommand(); }
else if(commandName == "align.seqs") { shellcommand = new AlignCommand(); }
else if(commandName == "summary.seqs") { shellcommand = new SeqSummaryCommand(); }