X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=commandfactory.cpp;h=c787d07e066ae08db298efb849966dcf0782113d;hb=df92022fc75c08b91cefa2c6ca4fd7b23eb480b0;hp=d2b22d59b06c469a12c7fce92b132a7971453f50;hpb=b5a791c81d432082bf38755a08b33863f255341d;p=mothur.git diff --git a/commandfactory.cpp b/commandfactory.cpp index d2b22d5..c787d07 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -16,7 +16,6 @@ #include "collectsharedcommand.h" #include "getgroupcommand.h" #include "getlabelcommand.h" -#include "getlinecommand.h" #include "rarefactcommand.h" #include "summarycommand.h" #include "summarysharedcommand.h" @@ -62,6 +61,9 @@ #include "phylotypecommand.h" #include "mgclustercommand.h" #include "preclustercommand.h" +#include "pcacommand.h" +#include "otuhierarchycommand.h" +#include "setdircommand.h" /*******************************************************/ @@ -76,10 +78,10 @@ CommandFactory* CommandFactory::getInstance() { /***********************************************************/ CommandFactory::CommandFactory(){ - _uniqueInstance = 0; string s = ""; command = new NoCommand(s); + outputDir = ""; inputDir = ""; //initialize list of valid commands commands["read.dist"] = "read.dist"; @@ -107,7 +109,6 @@ CommandFactory::CommandFactory(){ 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"; @@ -133,12 +134,15 @@ CommandFactory::CommandFactory(){ commands["phylotype"] = "phylotype"; commands["mgcluster"] = "mgcluster"; commands["pre.cluster"] = "pre.cluster"; - + commands["pcoa"] = "pcoa"; + commands["otu.hierarchy"] = "otu.hierarchy"; + commands["set.dir"] = "set.dir"; } /***********************************************************/ /***********************************************************/ CommandFactory::~CommandFactory(){ + _uniqueInstance = 0; delete command; } @@ -149,7 +153,19 @@ CommandFactory::~CommandFactory(){ Command* CommandFactory::getCommand(string commandName, string optionString){ try { delete command; //delete the old command - + + //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 { optionString += "outputdir=" + outputDir; } + } + + //user has opted to redirect input from dir where mothur.exe is located to some other place + if (inputDir != "") { + if (optionString != "") { optionString += ", inputdir=" + inputDir; } + else { optionString += "inputdir=" + inputDir; } + } + if(commandName == "read.dist") { command = new ReadDistCommand(optionString); } else if(commandName == "read.otu") { command = new ReadOtuCommand(optionString); } else if(commandName == "read.tree") { command = new ReadTreeCommand(optionString); } @@ -168,7 +184,6 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "unifrac.unweighted") { command = new UnifracUnweightedCommand(optionString); } else if(commandName == "get.group") { command = new GetgroupCommand(optionString); } else if(commandName == "get.label") { command = new GetlabelCommand(optionString); } - else if(commandName == "get.line") { command = new GetlineCommand(optionString); } else if(commandName == "get.sabund") { command = new GetSAbundCommand(optionString); } else if(commandName == "get.rabund") { command = new GetRAbundCommand(optionString); } else if(commandName == "libshuff") { command = new LibShuffCommand(optionString); } @@ -202,6 +217,9 @@ Command* CommandFactory::getCommand(string commandName, string optionString){ else if(commandName == "phylotype") { command = new PhylotypeCommand(optionString); } else if(commandName == "mgcluster") { command = new MGClusterCommand(optionString); } else if(commandName == "pre.cluster") { command = new PreClusterCommand(optionString); } + else if(commandName == "pcoa") { command = new PCACommand(optionString); } + else if(commandName == "otu.hierarchy") { command = new OtuHierarchyCommand(optionString); } + else if(commandName == "set.dir") { command = new SetDirectoryCommand(optionString); } else { command = new NoCommand(optionString); } return command;