5 * Created by Pat Schloss on 10/25/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
10 #include "command.hpp"
11 #include "readdistcommand.h"
12 #include "readtreecommand.h"
13 #include "readotucommand.h"
14 #include "clustercommand.h"
15 #include "parselistcommand.h"
16 #include "collectcommand.h"
17 #include "collectsharedcommand.h"
18 #include "getgroupcommand.h"
19 #include "getlabelcommand.h"
20 #include "getlinecommand.h"
21 #include "rarefactcommand.h"
22 #include "summarycommand.h"
23 #include "summarysharedcommand.h"
24 #include "rarefactsharedcommand.h"
25 #include "quitcommand.h"
26 #include "helpcommand.h"
27 #include "commandfactory.hpp"
28 #include "deconvolutecommand.h"
29 #include "parsimonycommand.h"
30 #include "unifracunweightedcommand.h"
31 #include "unifracweightedcommand.h"
32 #include "libshuffcommand.h"
33 #include "heatmapcommand.h"
34 #include "heatmapsimcommand.h"
35 #include "filterseqscommand.h"
37 #include "venncommand.h"
38 #include "nocommands.h"
39 #include "binsequencecommand.h"
40 #include "getoturepcommand.h"
41 #include "treegroupscommand.h"
42 #include "bootstrapsharedcommand.h"
43 #include "concensuscommand.h"
44 #include "distancecommand.h"
45 #include "aligncommand.h"
46 #include "matrixoutputcommand.h"
47 #include "getsabundcommand.h"
48 #include "getrabundcommand.h"
49 #include "seqsummarycommand.h"
50 #include "screenseqscommand.h"
51 #include "reversecommand.h"
52 #include "trimseqscommand.h"
54 /***********************************************************/
56 /***********************************************************/
57 CommandFactory::CommandFactory(){
59 command = new NoCommand(s);
61 /***********************************************************/
63 /***********************************************************/
64 CommandFactory::~CommandFactory(){
68 /***********************************************************/
70 /***********************************************************/
71 //This function calls the appropriate command fucntions based on user input.
72 Command* CommandFactory::getCommand(string commandName, string optionString){
74 delete command; //delete the old command
76 if(commandName == "read.dist") { command = new ReadDistCommand(optionString); }
77 else if(commandName == "read.otu") { command = new ReadOtuCommand(optionString); }
78 else if(commandName == "read.tree") { command = new ReadTreeCommand(optionString); }
79 else if(commandName == "cluster") { command = new ClusterCommand(optionString); }
80 else if(commandName == "unique.seqs") { command = new DeconvoluteCommand(optionString); }
81 else if(commandName == "parsimony") { command = new ParsimonyCommand(optionString); }
82 else if(commandName == "help") { command = new HelpCommand(optionString); }
83 else if(commandName == "quit") { command = new QuitCommand(optionString); }
84 else if(commandName == "collect.single") { command = new CollectCommand(optionString); }
85 else if(commandName == "collect.shared") { command = new CollectSharedCommand(optionString); }
86 else if(commandName == "rarefaction.single") { command = new RareFactCommand(optionString); }
87 else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(optionString); }
88 else if(commandName == "summary.single") { command = new SummaryCommand(optionString); }
89 else if(commandName == "summary.shared") { command = new SummarySharedCommand(optionString); }
90 else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(optionString); }
91 else if(commandName == "unifrac.unweighted") { command = new UnifracUnweightedCommand(optionString); }
92 else if(commandName == "get.group") { command = new GetgroupCommand(optionString); }
93 else if(commandName == "get.label") { command = new GetlabelCommand(optionString); }
94 else if(commandName == "get.line") { command = new GetlineCommand(optionString); }
95 else if(commandName == "get.sabund") { command = new GetSAbundCommand(optionString); }
96 else if(commandName == "get.rabund") { command = new GetRAbundCommand(optionString); }
97 else if(commandName == "libshuff") { command = new LibShuffCommand(optionString); }
98 else if(commandName == "heatmap.bin") { command = new HeatMapCommand(optionString); }
99 else if(commandName == "heatmap.sim") { command = new HeatMapSimCommand(optionString); }
100 else if(commandName == "filter.seqs") { command = new FilterSeqsCommand(optionString); }
101 else if(commandName == "venn") { command = new VennCommand(optionString); }
102 else if(commandName == "bin.seqs") { command = new BinSeqCommand(optionString); }
103 else if(commandName == "get.oturep") { command = new GetOTURepCommand(optionString); }
104 else if(commandName == "tree.shared") { command = new TreeGroupCommand(optionString); }
105 else if(commandName == "dist.shared") { command = new MatrixOutputCommand(optionString); }
106 else if(commandName == "bootstrap.shared") { command = new BootSharedCommand(optionString); }
107 else if(commandName == "concensus") { command = new ConcensusCommand(optionString); }
108 else if(commandName == "dist.seqs") { command = new DistanceCommand(optionString); }
109 else if(commandName == "align.seqs") { command = new AlignCommand(optionString); }
110 else if(commandName == "summary.seqs") { command = new SeqSummaryCommand(optionString); }
111 else if(commandName == "screen.seqs") { command = new ScreenSeqsCommand(optionString); }
112 else if(commandName == "reverse.seqs") { command = new ReverseSeqsCommand(optionString); }
113 else if(commandName == "trim.seqs") { command = new TrimSeqsCommand(optionString); }
114 else { command = new NoCommand(optionString); }
118 catch(exception& e) {
119 cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
123 cout << "An unknown error has occurred in the CommandFactory class function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
128 /***********************************************************/