-
- 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); }
- else if(commandName == "cluster") { command = new ClusterCommand(optionString); }
- else if(commandName == "unique.seqs") { command = new DeconvoluteCommand(optionString); }
- else if(commandName == "parsimony") { command = new ParsimonyCommand(optionString); }
- else if(commandName == "help") { command = new HelpCommand(optionString); }
- else if(commandName == "quit") { command = new QuitCommand(optionString); }
- else if(commandName == "collect.single") { command = new CollectCommand(optionString); }
- else if(commandName == "collect.shared") { command = new CollectSharedCommand(optionString); }
- else if(commandName == "rarefaction.single") { command = new RareFactCommand(optionString); }
- else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(optionString); }
- else if(commandName == "summary.single") { command = new SummaryCommand(optionString); }
- else if(commandName == "summary.shared") { command = new SummarySharedCommand(optionString); }
- else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(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); }
- else if(commandName == "heatmap.bin") { command = new HeatMapCommand(optionString); }
- else if(commandName == "heatmap.sim") { command = new HeatMapSimCommand(optionString); }
- else if(commandName == "filter.seqs") { command = new FilterSeqsCommand(optionString); }
- else if(commandName == "venn") { command = new VennCommand(optionString); }
- else if(commandName == "bin.seqs") { command = new BinSeqCommand(optionString); }
- 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); }
- else if(commandName == "screen.seqs") { command = new ScreenSeqsCommand(optionString); }
- else if(commandName == "reverse.seqs") { command = new ReverseSeqsCommand(optionString); }
- else if(commandName == "trim.seqs") { command = new TrimSeqsCommand(optionString); }
- else if(commandName == "chimera.seqs") { command = new ChimeraSeqsCommand(optionString); }
- else if(commandName == "list.seqs") { command = new ListSeqsCommand(optionString); }
- else if(commandName == "get.seqs") { command = new GetSeqsCommand(optionString); }
- else if(commandName == "remove.seqs") { command = new RemoveSeqsCommand(optionString); }
- else if(commandName == "merge.files") { command = new MergeFileCommand(optionString); }
- else if(commandName == "system") { command = new SystemCommand(optionString); }
- else if(commandName == "align.check") { command = new AlignCheckCommand(optionString); }
- else if(commandName == "get.sharedseqs") { command = new GetSharedOTUCommand(optionString); }
- else if(commandName == "get.otulist") { command = new GetListCountCommand(optionString); }
- else if(commandName == "hcluster") { command = new HClusterCommand(optionString); }
- else if(commandName == "classify.seqs") { command = new ClassifySeqsCommand(optionString); }
- else if(commandName == "phylotype") { command = new PhylotypeCommand(optionString); }
- else { command = new NoCommand(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 { 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); }
+ else if(commandName == "cluster") { command = new ClusterCommand(optionString); }
+ else if(commandName == "unique.seqs") { command = new DeconvoluteCommand(optionString); }
+ else if(commandName == "parsimony") { command = new ParsimonyCommand(optionString); }
+ else if(commandName == "help") { command = new HelpCommand(optionString); }
+ else if(commandName == "quit") { command = new QuitCommand(optionString); }
+ else if(commandName == "collect.single") { command = new CollectCommand(optionString); }
+ else if(commandName == "collect.shared") { command = new CollectSharedCommand(optionString); }
+ else if(commandName == "rarefaction.single") { command = new RareFactCommand(optionString); }
+ else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(optionString); }
+ else if(commandName == "summary.single") { command = new SummaryCommand(optionString); }
+ else if(commandName == "summary.shared") { command = new SummarySharedCommand(optionString); }
+ else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(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.sabund") { command = new GetSAbundCommand(optionString); }
+ else if(commandName == "get.rabund") { command = new GetRAbundCommand(optionString); }
+ else if(commandName == "libshuff") { command = new LibShuffCommand(optionString); }
+ else if(commandName == "heatmap.bin") { command = new HeatMapCommand(optionString); }
+ else if(commandName == "heatmap.sim") { command = new HeatMapSimCommand(optionString); }
+ else if(commandName == "filter.seqs") { command = new FilterSeqsCommand(optionString); }
+ else if(commandName == "venn") { command = new VennCommand(optionString); }
+ else if(commandName == "bin.seqs") { command = new BinSeqCommand(optionString); }
+ 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); }
+ else if(commandName == "screen.seqs") { command = new ScreenSeqsCommand(optionString); }
+ else if(commandName == "reverse.seqs") { command = new ReverseSeqsCommand(optionString); }
+ else if(commandName == "trim.seqs") { command = new TrimSeqsCommand(optionString); }
+ else if(commandName == "chimera.seqs") { command = new ChimeraSeqsCommand(optionString); }
+ else if(commandName == "list.seqs") { command = new ListSeqsCommand(optionString); }
+ else if(commandName == "get.seqs") { command = new GetSeqsCommand(optionString); }
+ else if(commandName == "remove.seqs") { command = new RemoveSeqsCommand(optionString); }
+ else if(commandName == "merge.files") { command = new MergeFileCommand(optionString); }
+ else if(commandName == "system") { command = new SystemCommand(optionString); }
+ else if(commandName == "align.check") { command = new AlignCheckCommand(optionString); }
+ else if(commandName == "get.sharedseqs") { command = new GetSharedOTUCommand(optionString); }
+ else if(commandName == "get.otulist") { command = new GetListCountCommand(optionString); }
+ else if(commandName == "hcluster") { command = new HClusterCommand(optionString); }
+ else if(commandName == "classify.seqs") { command = new ClassifySeqsCommand(optionString); }
+ else if(commandName == "chimera.ccode") { command = new ChimeraCcodeCommand(optionString); }
+ else if(commandName == "chimera.check") { command = new ChimeraCheckCommand(optionString); }
+ else if(commandName == "chimera.slayer") { command = new ChimeraSlayerCommand(optionString); }
+ else if(commandName == "chimera.pintail") { command = new ChimeraPintailCommand(optionString); }
+ else if(commandName == "chimera.bellerophon") { command = new ChimeraBellerophonCommand(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 if(commandName == "set.logfile") { command = new SetLogFileCommand(optionString); }
+ else if(commandName == "parse.list") { command = new ParseListCommand(optionString); }
+ else if(commandName == "parse.sff") { command = new ParseSFFCommand(optionString); }
+ else if(commandName == "phylo.diversity") { command = new PhyloDiversityCommand(optionString); }
+ else if(commandName == "make.group") { command = new MakeGroupCommand(optionString); }
+ else if(commandName == "chop.seqs") { command = new ChopSeqsCommand(optionString); }
+ else if(commandName == "clearcut") { command = new ClearcutCommand(optionString); }
+ else if(commandName == "catchall") { command = new CatchAllCommand(optionString); }
+ else if(commandName == "split.abund") { command = new SplitAbundCommand(optionString); }
+ else if(commandName == "cluster.split") { command = new ClusterSplitCommand(optionString); }
+ else if(commandName == "classify.otu") { command = new ClassifyOtuCommand(optionString); }
+ else { command = new NoCommand(optionString); }