4 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.
7 * The class CommandLineParser is used to parse the command line arguments. It then
8 * sets some parameters, and calls the required functions.
9 * To get it to parse the command line, and execute the required job, create a
10 * CommandLineParser object and pass the list of arguments to the constructor.
13 #ifndef COMMANDLINEPARSER_H
14 #define COMMANDLINEPARSER_H
18 #include "../Clustal.h"
19 #include "../general/clustalw.h"
20 #include "../general/userparams.h"
21 #include "../general/utils.h"
22 #include "../general/debuglogObject.h"
23 #include "../general/statsObject.h"
27 typedef std::vector<std::string> StringArray;
36 class CommandLineParser
40 CommandLineParser(StringArray* args, bool xmenus);
46 /** separate argument options and values
48 * put all the parameters and their values in the
49 * vectors, and also to check that all parameters that require a value
52 * @param args contains parameters as value and optional option pairs
53 * @param parameters used for storing parsed arguments
54 * @param paramArgs used for storing values of parsed arguments
55 * @return number of parsed parameters or -1 on error
57 int checkParam(StringArray* args, StringArray* params, StringArray* paramArg);
59 /** Parse all parameters
61 void parseParams(StringArray* args, bool xmenus);
62 void setOptionalParam();
63 int findMatch(string probe, StringArray* list, int n);
64 CmdLineData getCmdLineDataStruct(const char *str, int *flag, int type, StringArray* arg);
65 void printCmdLineData(const CmdLineData& temp);
66 string ConvertStringToLower(string strToConvert);
67 void exitWithErrorMsg(string msg);
68 void reportBadOptionAndExit(string option, string expectedType);
69 void reportInvalidOptionAndExit(string option);
75 static const int MAXARGS = 100;
76 static const int NOARG = 0;
77 static const int INTARG = 1;
78 static const int FLTARG = 2;
79 static const int STRARG = 3;
80 static const int FILARG = 4;
81 static const int OPTARG = 5;
144 int setSecStructOutput;
155 int setNumIterations;
156 int setTreeAlgorithm;
161 string userMatrixName;
162 string pwUserMatrixName;
163 string DNAUserMatrixName;
164 string pwDNAUserMatrixName;
166 CmdLineData cmdLineFile[4];
167 CmdLineData cmdLineVerb[20];
168 CmdLineData cmdLinePara[56];
170 string clustalTreeName;
172 string phylipTreeName;
173 string nexusTreeName;
178 StringArray* typeArg;
179 StringArray* bootLabelsArg;
180 StringArray* outOrderArg;
181 StringArray* caseArg;
182 StringArray* seqNoArg;
183 StringArray* seqNoRangeArg;
184 StringArray* scoreArg;
185 StringArray* outputArg;
186 StringArray* outputTreeArg;
187 StringArray* outputSecStrArg;
188 StringArray* cmdLineType;
189 StringArray* clusterAlgorithm;
190 StringArray* iterationArg;
192 StringArray* params; // parameter names
193 StringArray* paramArg; // parameter values