2 File autogenerated by gengetopt version 2.22.5
3 generated with the following command:
4 gengetopt -i RNALalifold.ggo --file-name=RNALalifold_cmdl --include-getopt --default-optional --unamed-opts --func-name=RNALalifold_cmdline_parser --arg-struct-name=RNALalifold_args_info
6 The developers of gengetopt consider the fixed text that goes in all
7 gengetopt output files to be in the public domain:
8 we make no copyright claims on it.
11 /* If we use autoconf. */
21 #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
25 #include "RNALalifold_cmdl.h"
27 const char *RNALalifold_args_info_purpose = "calculate locally stable secondary structures for a set of aligned RNAs";
29 const char *RNALalifold_args_info_usage = "Usage: RNALalifold [options] <file1.aln>";
31 const char *RNALalifold_args_info_description = "reads aligned RNA sequences from stdin or file.aln and calculates locally \nstable RNA secondary structure with a maximal base pair span. For a sequence of \nlength n and a base pair span of L the algorithm uses only O(n+L*L) memory and \nO(n*L*L) CPU time. Thus it is practical to \"scan\" very large genomes for \nshort RNA\n structures.\n";
33 const char *RNALalifold_args_info_detailed_help[] = {
34 " -h, --help Print help and exit",
35 " --detailed-help Print help, including all details and hidden \n options, and exit",
36 " --full-help Print help, including hidden options, and exit",
37 " -V, --version Print version and exit",
39 " Below are command line options which alter the general behavior of this \n program\n",
40 " -L, --span=INT Set the maximum allowed separation of a base \n pair to span. I.e. no pairs (i,j) with \n j-i>span will be allowed.\n\n (default=`70')",
41 " --csv Create comma seperated output (csv)\n\n (default=off)",
43 " Select additional algorithms which should be included in the calculations.\n The Minimum free energy (MFE) and a structure representative are calculated \n in any case.\n\n",
44 " -p, --partfunc[=INT] Calculate the partition function and base \n pairing probability matrix in addition to the \n mfe structure. (default=`1')",
45 " Default is calculation of mfe structure only. In addition to the MFE \n structure we print a coarse representation of the pair probabilities in form \n of a pseudo bracket notation, followed by the ensemble free energy, as well \n as the centroid structure derived from the pair probabilities together with \n its free energy and distance to the ensemble. Finally it prints the frequency \n of the mfe structure.\n\n An additionally passed value to this option changes the behavior of partition \n function calculation:\n -p0 \tCalculate the partition function but not the pair probabilities, saving \n about 50% in runtime. This prints the ensemble free energy -kT ln(Z).\n\n",
46 " -c, --cutoff=FLOAT Report only base pairs with an average \n probability > cutoff in the dot plot\n\n (default=`0.01')",
47 " -S, --pfScale=scaling factor In the calculation of the pf use scale*mfe as \n an estimate for the ensemble free energy \n (used to avoid overflows).\n",
48 " The default is 1.07, useful values are 1.0 to 1.2. Occasionally needed for \n long sequences.\n You can also recompile the program to use double precision (see the README \n file).\n\n",
49 " --mis Output \"most informative sequence\" instead of \n simple consensus: For each column of the \n alignment output the set of nucleotides with \n frequence greater than average in IUPAC \n notation.\n\n (default=off)",
51 " -T, --temp=DOUBLE Rescale energy parameters to a temperature of \n temp C. Default is 37C.\n\n",
52 " -4, --noTetra Do not include special tabulated stabilizing \n energies for tri-, tetra- and hexaloop \n hairpins. Mostly for testing.\n\n (default=off)",
53 " -d, --dangles=INT How to treat \"dangling end\" energies for \n bases adjacent to helices in free ends and \n multi-loops\n (default=`2')",
54 " \n With -d1 only unpaired bases can participate in at most one dangling end, \n this is unsupported for the partition function folding.\n\n With -d2 this check is ignored, dangling energies will be added for the bases \n adjacent to a helix on both sides in any case; this is the default for \n partition function folding (-p).\n The option -d0 ignores dangling ends altogether (mostly for debugging).\n With -d3 mfe folding will allow coaxial stacking of adjacent helices in \n multi-loops. At the moment the implementation will not allow coaxial stacking \n of the two interior pairs in a loop of degree 3 and works only for mfe \n folding.\n\n Note that by default (as well as with -d1 and -d3) pf and mfe folding treat \n dangling ends differently. Use -d2 in addition to -p to ensure that both \n algorithms use the same energy model.\n\n",
55 " --noLP Produce structures without lonely pairs \n (helices of length 1).\n (default=off)",
56 " For partition function folding this only disallows pairs that can only occur \n isolated. Other pairs may still occasionally occur as helices of length 1.\n\n",
57 " --noGU Do not allow GU pairs\n\n (default=off)",
58 " --noClosingGU Do not allow GU pairs at the end of helices\n\n (default=off)",
59 " -P, --paramFile=paramfile Read energy parameters from paramfile, instead \n of using the default parameter set.\n",
60 " A sample parameter file should accompany your distribution.\n See the RNAlib documentation for details on the file format.\n\n",
61 " --nsp=STRING Allow other pairs in addition to the usual \n AU,GC,and GU pairs.\n",
62 " Its argument is a comma separated list of additionally allowed pairs. If the \n first character is a \"-\" then AB will imply that AB and BA are allowed \n pairs.\n e.g. RNAfold -nsp -GA will allow GA and AG pairs. Nonstandard pairs are \n given 0 stacking energy.\n\n",
63 " -e, --energyModel=INT Rarely used option to fold sequences from the \n artificial ABCD... alphabet, where A pairs B, \n C-D etc. Use the energy parameters for GC \n (-e 1) or AU (-e 2) pairs.\n\n",
64 " --cfactor=DOUBLE Set the weight of the covariance term in the \n energy function\n\n (default=`1.0')",
65 " --nfactor=DOUBLE Set the penalty for non-compatible sequences in \n the covariance term of the energy function\n\n (default=`1.0')",
66 " -R, --ribosum_file=ribosumfile\n use specified Ribosum Matrix instead of normal \n energy model. Matrixes to use should be 6x6 \n matrices, the order of the terms is AU, CG, \n GC, GU, UA, UG.\n\n",
67 " -r, --ribosum_scoring use ribosum scoring matrix. The matrix is \n chosen according to the minimal and maximal \n pairwise identities of the sequences in the \n file.\n\n (default=off)",
68 "\nIf in doubt our program is right, nature is at fault.\nComments should be sent to rna@tbi.univie.ac.at.\n",
72 init_full_help_array(void)
74 RNALalifold_args_info_full_help[0] = RNALalifold_args_info_detailed_help[0];
75 RNALalifold_args_info_full_help[1] = RNALalifold_args_info_detailed_help[1];
76 RNALalifold_args_info_full_help[2] = RNALalifold_args_info_detailed_help[2];
77 RNALalifold_args_info_full_help[3] = RNALalifold_args_info_detailed_help[3];
78 RNALalifold_args_info_full_help[4] = RNALalifold_args_info_detailed_help[4];
79 RNALalifold_args_info_full_help[5] = RNALalifold_args_info_detailed_help[5];
80 RNALalifold_args_info_full_help[6] = RNALalifold_args_info_detailed_help[6];
81 RNALalifold_args_info_full_help[7] = RNALalifold_args_info_detailed_help[7];
82 RNALalifold_args_info_full_help[8] = RNALalifold_args_info_detailed_help[8];
83 RNALalifold_args_info_full_help[9] = RNALalifold_args_info_detailed_help[9];
84 RNALalifold_args_info_full_help[10] = RNALalifold_args_info_detailed_help[10];
85 RNALalifold_args_info_full_help[11] = RNALalifold_args_info_detailed_help[12];
86 RNALalifold_args_info_full_help[12] = RNALalifold_args_info_detailed_help[13];
87 RNALalifold_args_info_full_help[13] = RNALalifold_args_info_detailed_help[15];
88 RNALalifold_args_info_full_help[14] = RNALalifold_args_info_detailed_help[16];
89 RNALalifold_args_info_full_help[15] = RNALalifold_args_info_detailed_help[17];
90 RNALalifold_args_info_full_help[16] = RNALalifold_args_info_detailed_help[18];
91 RNALalifold_args_info_full_help[17] = RNALalifold_args_info_detailed_help[19];
92 RNALalifold_args_info_full_help[18] = RNALalifold_args_info_detailed_help[21];
93 RNALalifold_args_info_full_help[19] = RNALalifold_args_info_detailed_help[23];
94 RNALalifold_args_info_full_help[20] = RNALalifold_args_info_detailed_help[24];
95 RNALalifold_args_info_full_help[21] = RNALalifold_args_info_detailed_help[25];
96 RNALalifold_args_info_full_help[22] = RNALalifold_args_info_detailed_help[27];
97 RNALalifold_args_info_full_help[23] = RNALalifold_args_info_detailed_help[29];
98 RNALalifold_args_info_full_help[24] = RNALalifold_args_info_detailed_help[30];
99 RNALalifold_args_info_full_help[25] = RNALalifold_args_info_detailed_help[31];
100 RNALalifold_args_info_full_help[26] = RNALalifold_args_info_detailed_help[32];
101 RNALalifold_args_info_full_help[27] = RNALalifold_args_info_detailed_help[33];
102 RNALalifold_args_info_full_help[28] = RNALalifold_args_info_detailed_help[34];
103 RNALalifold_args_info_full_help[29] = 0;
107 const char *RNALalifold_args_info_full_help[30];
110 init_help_array(void)
112 RNALalifold_args_info_help[0] = RNALalifold_args_info_detailed_help[0];
113 RNALalifold_args_info_help[1] = RNALalifold_args_info_detailed_help[1];
114 RNALalifold_args_info_help[2] = RNALalifold_args_info_detailed_help[2];
115 RNALalifold_args_info_help[3] = RNALalifold_args_info_detailed_help[3];
116 RNALalifold_args_info_help[4] = RNALalifold_args_info_detailed_help[4];
117 RNALalifold_args_info_help[5] = RNALalifold_args_info_detailed_help[5];
118 RNALalifold_args_info_help[6] = RNALalifold_args_info_detailed_help[6];
119 RNALalifold_args_info_help[7] = RNALalifold_args_info_detailed_help[7];
120 RNALalifold_args_info_help[8] = RNALalifold_args_info_detailed_help[8];
121 RNALalifold_args_info_help[9] = RNALalifold_args_info_detailed_help[9];
122 RNALalifold_args_info_help[10] = RNALalifold_args_info_detailed_help[10];
123 RNALalifold_args_info_help[11] = RNALalifold_args_info_detailed_help[12];
124 RNALalifold_args_info_help[12] = RNALalifold_args_info_detailed_help[15];
125 RNALalifold_args_info_help[13] = RNALalifold_args_info_detailed_help[16];
126 RNALalifold_args_info_help[14] = RNALalifold_args_info_detailed_help[17];
127 RNALalifold_args_info_help[15] = RNALalifold_args_info_detailed_help[18];
128 RNALalifold_args_info_help[16] = RNALalifold_args_info_detailed_help[19];
129 RNALalifold_args_info_help[17] = RNALalifold_args_info_detailed_help[21];
130 RNALalifold_args_info_help[18] = RNALalifold_args_info_detailed_help[23];
131 RNALalifold_args_info_help[19] = RNALalifold_args_info_detailed_help[24];
132 RNALalifold_args_info_help[20] = RNALalifold_args_info_detailed_help[25];
133 RNALalifold_args_info_help[21] = RNALalifold_args_info_detailed_help[30];
134 RNALalifold_args_info_help[22] = RNALalifold_args_info_detailed_help[31];
135 RNALalifold_args_info_help[23] = RNALalifold_args_info_detailed_help[32];
136 RNALalifold_args_info_help[24] = RNALalifold_args_info_detailed_help[33];
137 RNALalifold_args_info_help[25] = RNALalifold_args_info_detailed_help[34];
138 RNALalifold_args_info_help[26] = 0;
142 const char *RNALalifold_args_info_help[27];
150 } RNALalifold_cmdline_parser_arg_type;
153 void clear_given (struct RNALalifold_args_info *args_info);
155 void clear_args (struct RNALalifold_args_info *args_info);
158 RNALalifold_cmdline_parser_internal (int argc, char **argv, struct RNALalifold_args_info *args_info,
159 struct RNALalifold_cmdline_parser_params *params, const char *additional_error);
163 gengetopt_strdup (const char *s);
166 void clear_given (struct RNALalifold_args_info *args_info)
168 args_info->help_given = 0 ;
169 args_info->detailed_help_given = 0 ;
170 args_info->full_help_given = 0 ;
171 args_info->version_given = 0 ;
172 args_info->span_given = 0 ;
173 args_info->csv_given = 0 ;
174 args_info->partfunc_given = 0 ;
175 args_info->cutoff_given = 0 ;
176 args_info->pfScale_given = 0 ;
177 args_info->mis_given = 0 ;
178 args_info->temp_given = 0 ;
179 args_info->noTetra_given = 0 ;
180 args_info->dangles_given = 0 ;
181 args_info->noLP_given = 0 ;
182 args_info->noGU_given = 0 ;
183 args_info->noClosingGU_given = 0 ;
184 args_info->paramFile_given = 0 ;
185 args_info->nsp_given = 0 ;
186 args_info->energyModel_given = 0 ;
187 args_info->cfactor_given = 0 ;
188 args_info->nfactor_given = 0 ;
189 args_info->ribosum_file_given = 0 ;
190 args_info->ribosum_scoring_given = 0 ;
194 void clear_args (struct RNALalifold_args_info *args_info)
196 FIX_UNUSED (args_info);
197 args_info->span_arg = 70;
198 args_info->span_orig = NULL;
199 args_info->csv_flag = 0;
200 args_info->partfunc_arg = 1;
201 args_info->partfunc_orig = NULL;
202 args_info->cutoff_arg = 0.01;
203 args_info->cutoff_orig = NULL;
204 args_info->pfScale_orig = NULL;
205 args_info->mis_flag = 0;
206 args_info->temp_orig = NULL;
207 args_info->noTetra_flag = 0;
208 args_info->dangles_arg = 2;
209 args_info->dangles_orig = NULL;
210 args_info->noLP_flag = 0;
211 args_info->noGU_flag = 0;
212 args_info->noClosingGU_flag = 0;
213 args_info->paramFile_arg = NULL;
214 args_info->paramFile_orig = NULL;
215 args_info->nsp_arg = NULL;
216 args_info->nsp_orig = NULL;
217 args_info->energyModel_orig = NULL;
218 args_info->cfactor_arg = 1.0;
219 args_info->cfactor_orig = NULL;
220 args_info->nfactor_arg = 1.0;
221 args_info->nfactor_orig = NULL;
222 args_info->ribosum_file_arg = NULL;
223 args_info->ribosum_file_orig = NULL;
224 args_info->ribosum_scoring_flag = 0;
229 void init_args_info(struct RNALalifold_args_info *args_info)
231 init_full_help_array();
233 args_info->help_help = RNALalifold_args_info_detailed_help[0] ;
234 args_info->detailed_help_help = RNALalifold_args_info_detailed_help[1] ;
235 args_info->full_help_help = RNALalifold_args_info_detailed_help[2] ;
236 args_info->version_help = RNALalifold_args_info_detailed_help[3] ;
237 args_info->span_help = RNALalifold_args_info_detailed_help[6] ;
238 args_info->csv_help = RNALalifold_args_info_detailed_help[7] ;
239 args_info->partfunc_help = RNALalifold_args_info_detailed_help[10] ;
240 args_info->cutoff_help = RNALalifold_args_info_detailed_help[12] ;
241 args_info->pfScale_help = RNALalifold_args_info_detailed_help[13] ;
242 args_info->mis_help = RNALalifold_args_info_detailed_help[15] ;
243 args_info->temp_help = RNALalifold_args_info_detailed_help[17] ;
244 args_info->noTetra_help = RNALalifold_args_info_detailed_help[18] ;
245 args_info->dangles_help = RNALalifold_args_info_detailed_help[19] ;
246 args_info->noLP_help = RNALalifold_args_info_detailed_help[21] ;
247 args_info->noGU_help = RNALalifold_args_info_detailed_help[23] ;
248 args_info->noClosingGU_help = RNALalifold_args_info_detailed_help[24] ;
249 args_info->paramFile_help = RNALalifold_args_info_detailed_help[25] ;
250 args_info->nsp_help = RNALalifold_args_info_detailed_help[27] ;
251 args_info->energyModel_help = RNALalifold_args_info_detailed_help[29] ;
252 args_info->cfactor_help = RNALalifold_args_info_detailed_help[30] ;
253 args_info->nfactor_help = RNALalifold_args_info_detailed_help[31] ;
254 args_info->ribosum_file_help = RNALalifold_args_info_detailed_help[32] ;
255 args_info->ribosum_scoring_help = RNALalifold_args_info_detailed_help[33] ;
260 RNALalifold_cmdline_parser_print_version (void)
263 (strlen(RNALALIFOLD_CMDLINE_PARSER_PACKAGE_NAME) ? RNALALIFOLD_CMDLINE_PARSER_PACKAGE_NAME : RNALALIFOLD_CMDLINE_PARSER_PACKAGE),
264 RNALALIFOLD_CMDLINE_PARSER_VERSION);
267 static void print_help_common(void) {
268 RNALalifold_cmdline_parser_print_version ();
270 if (strlen(RNALalifold_args_info_purpose) > 0)
271 printf("\n%s\n", RNALalifold_args_info_purpose);
273 if (strlen(RNALalifold_args_info_usage) > 0)
274 printf("\n%s\n", RNALalifold_args_info_usage);
278 if (strlen(RNALalifold_args_info_description) > 0)
279 printf("%s\n\n", RNALalifold_args_info_description);
283 RNALalifold_cmdline_parser_print_help (void)
287 while (RNALalifold_args_info_help[i])
288 printf("%s\n", RNALalifold_args_info_help[i++]);
292 RNALalifold_cmdline_parser_print_full_help (void)
296 while (RNALalifold_args_info_full_help[i])
297 printf("%s\n", RNALalifold_args_info_full_help[i++]);
301 RNALalifold_cmdline_parser_print_detailed_help (void)
305 while (RNALalifold_args_info_detailed_help[i])
306 printf("%s\n", RNALalifold_args_info_detailed_help[i++]);
310 RNALalifold_cmdline_parser_init (struct RNALalifold_args_info *args_info)
312 clear_given (args_info);
313 clear_args (args_info);
314 init_args_info (args_info);
316 args_info->inputs = 0;
317 args_info->inputs_num = 0;
321 RNALalifold_cmdline_parser_params_init(struct RNALalifold_cmdline_parser_params *params)
325 params->override = 0;
326 params->initialize = 1;
327 params->check_required = 1;
328 params->check_ambiguity = 0;
329 params->print_errors = 1;
333 struct RNALalifold_cmdline_parser_params *
334 RNALalifold_cmdline_parser_params_create(void)
336 struct RNALalifold_cmdline_parser_params *params =
337 (struct RNALalifold_cmdline_parser_params *)malloc(sizeof(struct RNALalifold_cmdline_parser_params));
338 RNALalifold_cmdline_parser_params_init(params);
343 free_string_field (char **s)
354 RNALalifold_cmdline_parser_release (struct RNALalifold_args_info *args_info)
357 free_string_field (&(args_info->span_orig));
358 free_string_field (&(args_info->partfunc_orig));
359 free_string_field (&(args_info->cutoff_orig));
360 free_string_field (&(args_info->pfScale_orig));
361 free_string_field (&(args_info->temp_orig));
362 free_string_field (&(args_info->dangles_orig));
363 free_string_field (&(args_info->paramFile_arg));
364 free_string_field (&(args_info->paramFile_orig));
365 free_string_field (&(args_info->nsp_arg));
366 free_string_field (&(args_info->nsp_orig));
367 free_string_field (&(args_info->energyModel_orig));
368 free_string_field (&(args_info->cfactor_orig));
369 free_string_field (&(args_info->nfactor_orig));
370 free_string_field (&(args_info->ribosum_file_arg));
371 free_string_field (&(args_info->ribosum_file_orig));
374 for (i = 0; i < args_info->inputs_num; ++i)
375 free (args_info->inputs [i]);
377 if (args_info->inputs_num)
378 free (args_info->inputs);
380 clear_given (args_info);
385 write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
389 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
391 fprintf(outfile, "%s\n", opt);
397 RNALalifold_cmdline_parser_dump(FILE *outfile, struct RNALalifold_args_info *args_info)
403 fprintf (stderr, "%s: cannot dump options to stream\n", RNALALIFOLD_CMDLINE_PARSER_PACKAGE);
407 if (args_info->help_given)
408 write_into_file(outfile, "help", 0, 0 );
409 if (args_info->detailed_help_given)
410 write_into_file(outfile, "detailed-help", 0, 0 );
411 if (args_info->full_help_given)
412 write_into_file(outfile, "full-help", 0, 0 );
413 if (args_info->version_given)
414 write_into_file(outfile, "version", 0, 0 );
415 if (args_info->span_given)
416 write_into_file(outfile, "span", args_info->span_orig, 0);
417 if (args_info->csv_given)
418 write_into_file(outfile, "csv", 0, 0 );
419 if (args_info->partfunc_given)
420 write_into_file(outfile, "partfunc", args_info->partfunc_orig, 0);
421 if (args_info->cutoff_given)
422 write_into_file(outfile, "cutoff", args_info->cutoff_orig, 0);
423 if (args_info->pfScale_given)
424 write_into_file(outfile, "pfScale", args_info->pfScale_orig, 0);
425 if (args_info->mis_given)
426 write_into_file(outfile, "mis", 0, 0 );
427 if (args_info->temp_given)
428 write_into_file(outfile, "temp", args_info->temp_orig, 0);
429 if (args_info->noTetra_given)
430 write_into_file(outfile, "noTetra", 0, 0 );
431 if (args_info->dangles_given)
432 write_into_file(outfile, "dangles", args_info->dangles_orig, 0);
433 if (args_info->noLP_given)
434 write_into_file(outfile, "noLP", 0, 0 );
435 if (args_info->noGU_given)
436 write_into_file(outfile, "noGU", 0, 0 );
437 if (args_info->noClosingGU_given)
438 write_into_file(outfile, "noClosingGU", 0, 0 );
439 if (args_info->paramFile_given)
440 write_into_file(outfile, "paramFile", args_info->paramFile_orig, 0);
441 if (args_info->nsp_given)
442 write_into_file(outfile, "nsp", args_info->nsp_orig, 0);
443 if (args_info->energyModel_given)
444 write_into_file(outfile, "energyModel", args_info->energyModel_orig, 0);
445 if (args_info->cfactor_given)
446 write_into_file(outfile, "cfactor", args_info->cfactor_orig, 0);
447 if (args_info->nfactor_given)
448 write_into_file(outfile, "nfactor", args_info->nfactor_orig, 0);
449 if (args_info->ribosum_file_given)
450 write_into_file(outfile, "ribosum_file", args_info->ribosum_file_orig, 0);
451 if (args_info->ribosum_scoring_given)
452 write_into_file(outfile, "ribosum_scoring", 0, 0 );
460 RNALalifold_cmdline_parser_file_save(const char *filename, struct RNALalifold_args_info *args_info)
465 outfile = fopen(filename, "w");
469 fprintf (stderr, "%s: cannot open file for writing: %s\n", RNALALIFOLD_CMDLINE_PARSER_PACKAGE, filename);
473 i = RNALalifold_cmdline_parser_dump(outfile, args_info);
480 RNALalifold_cmdline_parser_free (struct RNALalifold_args_info *args_info)
482 RNALalifold_cmdline_parser_release (args_info);
485 /** @brief replacement of strdup, which is not standard */
487 gengetopt_strdup (const char *s)
493 result = (char*)malloc(strlen(s) + 1);
494 if (result == (char*)0)
501 RNALalifold_cmdline_parser (int argc, char **argv, struct RNALalifold_args_info *args_info)
503 return RNALalifold_cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
507 RNALalifold_cmdline_parser_ext (int argc, char **argv, struct RNALalifold_args_info *args_info,
508 struct RNALalifold_cmdline_parser_params *params)
511 result = RNALalifold_cmdline_parser_internal (argc, argv, args_info, params, 0);
513 if (result == EXIT_FAILURE)
515 RNALalifold_cmdline_parser_free (args_info);
523 RNALalifold_cmdline_parser2 (int argc, char **argv, struct RNALalifold_args_info *args_info, int override, int initialize, int check_required)
526 struct RNALalifold_cmdline_parser_params params;
528 params.override = override;
529 params.initialize = initialize;
530 params.check_required = check_required;
531 params.check_ambiguity = 0;
532 params.print_errors = 1;
534 result = RNALalifold_cmdline_parser_internal (argc, argv, args_info, ¶ms, 0);
536 if (result == EXIT_FAILURE)
538 RNALalifold_cmdline_parser_free (args_info);
546 RNALalifold_cmdline_parser_required (struct RNALalifold_args_info *args_info, const char *prog_name)
548 FIX_UNUSED (args_info);
549 FIX_UNUSED (prog_name);
554 * Extracted from the glibc source tree, version 2.3.6
556 * Licensed under the GPL as per the whole glibc source tree.
558 * This file was modified so that getopt_long can be called
559 * many times without risking previous memory to be spoiled.
561 * Modified by Andre Noll and Lorenzo Bettini for use in
562 * GNU gengetopt generated files.
567 * we must include anything we need since this file is not thought to be
568 * inserted in a file already using getopt.h
576 /* has_arg can't be an enum because some compilers complain about
577 type mismatches in all the code that assumes it is an int. */
583 /* This version of `getopt' appears to the caller like standard Unix `getopt'
584 but it behaves differently for the user, since it allows the user
585 to intersperse the options with the other arguments.
587 As `getopt' works, it permutes the elements of ARGV so that,
588 when it is done, all the options precede everything else. Thus
589 all application programs are extended to handle flexible argument order.
592 If the field `flag' is not NULL, it points to a variable that is set
593 to the value given in the field `val' when the option is found, but
594 left unchanged if the option is not found.
596 To have a long-named option do something other than set an `int' to
597 a compiled-in constant, such as set a value from `custom_optarg', set the
598 option's `flag' field to zero and its `val' field to a nonzero
599 value (the equivalent single-letter option character, if there is
600 one). For long options that have a zero `flag' field, `getopt'
601 returns the contents of the `val' field. */
603 /* Names for the values of the `has_arg' field of `struct option'. */
605 #define no_argument 0
608 #ifndef required_argument
609 #define required_argument 1
612 #ifndef optional_argument
613 #define optional_argument 2
616 struct custom_getopt_data {
618 * These have exactly the same meaning as the corresponding global variables,
619 * except that they are used for the reentrant versions of getopt.
626 /* True if the internal members have been initialized. */
630 * The next char to be scanned in the option-element in which the last option
631 * character we returned was found. This allows us to pick up the scan where
632 * we left off. If this is zero, or a null string, it means resume the scan by
633 * advancing to the next ARGV-element.
638 * Describe the part of ARGV that contains non-options that have been skipped.
639 * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
640 * the index after the last of them.
647 * the variables optarg, optind, opterr and optopt are renamed with
648 * the custom_ prefix so that they don't interfere with getopt ones.
650 * Moreover they're static so they are visible only from within the
651 * file where this very file will be included.
655 * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an
656 * option that takes an argument, the argument value is returned here.
658 static char *custom_optarg;
661 * Index in ARGV of the next element to be scanned. This is used for
662 * communication to and from the caller and for communication between
663 * successive calls to `custom_getopt'.
665 * On entry to `custom_getopt', 1 means this is the first call; initialize.
667 * When `custom_getopt' returns -1, this is the index of the first of the non-option
668 * elements that the caller should itself scan.
670 * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV
671 * has been scanned so far.
673 * 1003.2 says this must be 1 before any call.
675 static int custom_optind = 1;
678 * Callers store zero here to inhibit the error message for unrecognized
681 static int custom_opterr = 1;
684 * Set to an option character which was unrecognized. This must be initialized
685 * on some systems to avoid linking in the system's own getopt implementation.
687 static int custom_optopt = '?';
690 * Exchange two adjacent subsequences of ARGV. One subsequence is elements
691 * [first_nonopt,last_nonopt) which contains all the non-options that have been
692 * skipped so far. The other is elements [last_nonopt,custom_optind), which contains
693 * all the options processed since those non-options were skipped.
694 * `first_nonopt' and `last_nonopt' are relocated so that they describe the new
695 * indices of the non-options in ARGV after they are moved.
697 static void exchange(char **argv, struct custom_getopt_data *d)
699 int bottom = d->first_nonopt;
700 int middle = d->last_nonopt;
701 int top = d->custom_optind;
705 * Exchange the shorter segment with the far end of the longer segment.
706 * That puts the shorter segment into the right place. It leaves the
707 * longer segment in the right place overall, but it consists of two
708 * parts that need to be swapped next.
710 while (top > middle && middle > bottom) {
711 if (top - middle > middle - bottom) {
712 /* Bottom segment is the short one. */
713 int len = middle - bottom;
716 /* Swap it with the top part of the top segment. */
717 for (i = 0; i < len; i++) {
718 tem = argv[bottom + i];
720 argv[top - (middle - bottom) + i];
721 argv[top - (middle - bottom) + i] = tem;
723 /* Exclude the moved bottom segment from further swapping. */
726 /* Top segment is the short one. */
727 int len = top - middle;
730 /* Swap it with the bottom part of the bottom segment. */
731 for (i = 0; i < len; i++) {
732 tem = argv[bottom + i];
733 argv[bottom + i] = argv[middle + i];
734 argv[middle + i] = tem;
736 /* Exclude the moved top segment from further swapping. */
740 /* Update records for the slots the non-options now occupy. */
741 d->first_nonopt += (d->custom_optind - d->last_nonopt);
742 d->last_nonopt = d->custom_optind;
745 /* Initialize the internal data when the first call is made. */
746 static void custom_getopt_initialize(struct custom_getopt_data *d)
749 * Start processing options with ARGV-element 1 (since ARGV-element 0
750 * is the program name); the sequence of previously skipped non-option
751 * ARGV-elements is empty.
753 d->first_nonopt = d->last_nonopt = d->custom_optind;
758 #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
760 /* return: zero: continue, nonzero: return given value to user */
761 static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
762 struct custom_getopt_data *d)
765 * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
766 * moved back by the user (who may also have changed the arguments).
768 if (d->last_nonopt > d->custom_optind)
769 d->last_nonopt = d->custom_optind;
770 if (d->first_nonopt > d->custom_optind)
771 d->first_nonopt = d->custom_optind;
773 * If we have just processed some options following some
774 * non-options, exchange them so that the options come first.
776 if (d->first_nonopt != d->last_nonopt &&
777 d->last_nonopt != d->custom_optind)
778 exchange((char **) argv, d);
779 else if (d->last_nonopt != d->custom_optind)
780 d->first_nonopt = d->custom_optind;
782 * Skip any additional non-options and extend the range of
783 * non-options previously skipped.
785 while (d->custom_optind < argc && NONOPTION_P)
787 d->last_nonopt = d->custom_optind;
789 * The special ARGV-element `--' means premature end of options. Skip
790 * it like a null option, then exchange with previous non-options as if
791 * it were an option, then skip everything else like a non-option.
793 if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
795 if (d->first_nonopt != d->last_nonopt
796 && d->last_nonopt != d->custom_optind)
797 exchange((char **) argv, d);
798 else if (d->first_nonopt == d->last_nonopt)
799 d->first_nonopt = d->custom_optind;
800 d->last_nonopt = argc;
801 d->custom_optind = argc;
804 * If we have done all the ARGV-elements, stop the scan and back over
805 * any non-options that we skipped and permuted.
807 if (d->custom_optind == argc) {
809 * Set the next-arg-index to point at the non-options that we
810 * previously skipped, so the caller will digest them.
812 if (d->first_nonopt != d->last_nonopt)
813 d->custom_optind = d->first_nonopt;
817 * If we have come to a non-option and did not permute it, either stop
818 * the scan or describe it to the caller and pass it by.
821 d->custom_optarg = argv[d->custom_optind++];
825 * We have found another option-ARGV-element. Skip the initial
828 d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
833 * Check whether the ARGV-element is a long option.
835 * If there's a long option "fubar" and the ARGV-element is "-fu", consider
836 * that an abbreviation of the long option, just like "--fu", and not "-f" with
839 * This distinction seems to be the most useful approach.
842 static int check_long_opt(int argc, char *const *argv, const char *optstring,
843 const struct option *longopts, int *longind,
844 int print_errors, struct custom_getopt_data *d)
847 const struct option *p;
848 const struct option *pfound = NULL;
854 for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
857 /* Test all long options for either exact match or abbreviated matches */
858 for (p = longopts, option_index = 0; p->name; p++, option_index++)
859 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
860 if ((unsigned int) (nameend - d->nextchar)
861 == (unsigned int) strlen(p->name)) {
862 /* Exact match found. */
864 indfound = option_index;
867 } else if (pfound == NULL) {
868 /* First nonexact match found. */
870 indfound = option_index;
871 } else if (pfound->has_arg != p->has_arg
872 || pfound->flag != p->flag
873 || pfound->val != p->val)
874 /* Second or later nonexact match found. */
877 if (ambig && !exact) {
880 "%s: option `%s' is ambiguous\n",
881 argv[0], argv[d->custom_optind]);
883 d->nextchar += strlen(d->nextchar);
885 d->custom_optopt = 0;
889 option_index = indfound;
892 if (pfound->has_arg != no_argument)
893 d->custom_optarg = nameend + 1;
896 if (argv[d->custom_optind - 1][1] == '-') {
898 fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
899 argv[0], pfound->name);
901 /* +option or -option */
902 fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
903 argv[0], argv[d->custom_optind - 1][0], pfound->name);
907 d->nextchar += strlen(d->nextchar);
908 d->custom_optopt = pfound->val;
911 } else if (pfound->has_arg == required_argument) {
912 if (d->custom_optind < argc)
913 d->custom_optarg = argv[d->custom_optind++];
917 "%s: option `%s' requires an argument\n",
919 argv[d->custom_optind - 1]);
921 d->nextchar += strlen(d->nextchar);
922 d->custom_optopt = pfound->val;
923 return optstring[0] == ':' ? ':' : '?';
926 d->nextchar += strlen(d->nextchar);
928 *longind = option_index;
930 *(pfound->flag) = pfound->val;
936 * Can't find it as a long option. If this is not getopt_long_only, or
937 * the option starts with '--' or is not a valid short option, then
938 * it's an error. Otherwise interpret it as a short option.
941 if (argv[d->custom_optind][1] == '-') {
944 "%s: unrecognized option `--%s'\n",
945 argv[0], d->nextchar);
947 /* +option or -option */
949 "%s: unrecognized option `%c%s'\n",
950 argv[0], argv[d->custom_optind][0],
954 d->nextchar = (char *) "";
956 d->custom_optopt = 0;
960 static int check_short_opt(int argc, char *const *argv, const char *optstring,
961 int print_errors, struct custom_getopt_data *d)
963 char c = *d->nextchar++;
964 const char *temp = strchr(optstring, c);
966 /* Increment `custom_optind' when we start to process its last character. */
967 if (*d->nextchar == '\0')
969 if (!temp || c == ':') {
971 fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
973 d->custom_optopt = c;
976 if (temp[1] == ':') {
977 if (temp[2] == ':') {
978 /* This is an option that accepts an argument optionally. */
979 if (*d->nextchar != '\0') {
980 d->custom_optarg = d->nextchar;
983 d->custom_optarg = NULL;
986 /* This is an option that requires an argument. */
987 if (*d->nextchar != '\0') {
988 d->custom_optarg = d->nextchar;
990 * If we end this ARGV-element by taking the
991 * rest as an arg, we must advance to the next
995 } else if (d->custom_optind == argc) {
998 "%s: option requires an argument -- %c\n",
1001 d->custom_optopt = c;
1002 if (optstring[0] == ':')
1008 * We already incremented `custom_optind' once;
1009 * increment it again when taking next ARGV-elt
1012 d->custom_optarg = argv[d->custom_optind++];
1020 * Scan elements of ARGV for option characters given in OPTSTRING.
1022 * If an element of ARGV starts with '-', and is not exactly "-" or "--",
1023 * then it is an option element. The characters of this element
1024 * (aside from the initial '-') are option characters. If `getopt'
1025 * is called repeatedly, it returns successively each of the option characters
1026 * from each of the option elements.
1028 * If `getopt' finds another option character, it returns that character,
1029 * updating `custom_optind' and `nextchar' so that the next call to `getopt' can
1030 * resume the scan with the following option character or ARGV-element.
1032 * If there are no more option characters, `getopt' returns -1.
1033 * Then `custom_optind' is the index in ARGV of the first ARGV-element
1034 * that is not an option. (The ARGV-elements have been permuted
1035 * so that those that are not options now come last.)
1037 * OPTSTRING is a string containing the legitimate option characters.
1038 * If an option character is seen that is not listed in OPTSTRING,
1039 * return '?' after printing an error message. If you set `custom_opterr' to
1040 * zero, the error message is suppressed but we still return '?'.
1042 * If a char in OPTSTRING is followed by a colon, that means it wants an arg,
1043 * so the following text in the same ARGV-element, or the text of the following
1044 * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that
1045 * wants an optional arg; if there is text in the current ARGV-element,
1046 * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero.
1048 * If OPTSTRING starts with `-' or `+', it requests different methods of
1049 * handling the non-option ARGV-elements.
1050 * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
1052 * Long-named options begin with `--' instead of `-'.
1053 * Their names may be abbreviated as long as the abbreviation is unique
1054 * or is an exact match for some defined option. If they have an
1055 * argument, it follows the option name in the same ARGV-element, separated
1056 * from the option name by a `=', or else the in next ARGV-element.
1057 * When `getopt' finds a long-named option, it returns 0 if that option's
1058 * `flag' field is nonzero, the value of the option's `val' field
1059 * if the `flag' field is zero.
1061 * The elements of ARGV aren't really const, because we permute them.
1062 * But we pretend they're const in the prototype to be compatible
1063 * with other systems.
1065 * LONGOPTS is a vector of `struct option' terminated by an
1066 * element containing a name which is zero.
1068 * LONGIND returns the index in LONGOPT of the long-named option found.
1069 * It is only valid when a long-named option has been found by the most
1072 * Return the option character from OPTS just read. Return -1 when there are
1073 * no more options. For unrecognized options, or options missing arguments,
1074 * `custom_optopt' is set to the option letter, and '?' is returned.
1076 * The OPTS string is a list of characters which are recognized option letters,
1077 * optionally followed by colons, specifying that that letter takes an
1078 * argument, to be placed in `custom_optarg'.
1080 * If a letter in OPTS is followed by two colons, its argument is optional.
1081 * This behavior is specific to the GNU `getopt'.
1083 * The argument `--' causes premature termination of argument scanning,
1084 * explicitly telling `getopt' that there are no more options. If OPTS begins
1085 * with `--', then non-option arguments are treated as arguments to the option
1086 * '\0'. This behavior is specific to the GNU `getopt'.
1089 static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
1090 const struct option *longopts, int *longind,
1091 struct custom_getopt_data *d)
1093 int ret, print_errors = d->custom_opterr;
1095 if (optstring[0] == ':')
1099 d->custom_optarg = NULL;
1102 * This is a big difference with GNU getopt, since optind == 0
1103 * means initialization while here 1 means first call.
1105 if (d->custom_optind == 0 || !d->initialized) {
1106 if (d->custom_optind == 0)
1107 d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
1108 custom_getopt_initialize(d);
1110 if (d->nextchar == NULL || *d->nextchar == '\0') {
1111 ret = shuffle_argv(argc, argv, longopts, d);
1115 if (longopts && (argv[d->custom_optind][1] == '-' ))
1116 return check_long_opt(argc, argv, optstring, longopts,
1117 longind, print_errors, d);
1118 return check_short_opt(argc, argv, optstring, print_errors, d);
1121 static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
1122 const struct option *longopts, int *longind)
1125 /* Keep a global copy of all internal members of d */
1126 static struct custom_getopt_data d;
1128 d.custom_optind = custom_optind;
1129 d.custom_opterr = custom_opterr;
1130 result = getopt_internal_r(argc, argv, optstring, longopts,
1132 custom_optind = d.custom_optind;
1133 custom_optarg = d.custom_optarg;
1134 custom_optopt = d.custom_optopt;
1138 static int custom_getopt_long (int argc, char *const *argv, const char *options,
1139 const struct option *long_options, int *opt_index)
1141 return custom_getopt_internal(argc, argv, options, long_options,
1146 static char *package_name = 0;
1149 * @brief updates an option
1150 * @param field the generic pointer to the field to update
1151 * @param orig_field the pointer to the orig field
1152 * @param field_given the pointer to the number of occurrence of this option
1153 * @param prev_given the pointer to the number of occurrence already seen
1154 * @param value the argument for this option (if null no arg was specified)
1155 * @param possible_values the possible values for this option (if specified)
1156 * @param default_value the default value (in case the option only accepts fixed values)
1157 * @param arg_type the type of this option
1158 * @param check_ambiguity @see RNALalifold_cmdline_parser_params.check_ambiguity
1159 * @param override @see RNALalifold_cmdline_parser_params.override
1160 * @param no_free whether to free a possible previous value
1161 * @param multiple_option whether this is a multiple option
1162 * @param long_opt the corresponding long option
1163 * @param short_opt the corresponding short option (or '-' if none)
1164 * @param additional_error possible further error specification
1167 int update_arg(void *field, char **orig_field,
1168 unsigned int *field_given, unsigned int *prev_given,
1169 char *value, const char *possible_values[],
1170 const char *default_value,
1171 RNALalifold_cmdline_parser_arg_type arg_type,
1172 int check_ambiguity, int override,
1173 int no_free, int multiple_option,
1174 const char *long_opt, char short_opt,
1175 const char *additional_error)
1177 char *stop_char = 0;
1178 const char *val = value;
1180 char **string_field;
1186 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1188 if (short_opt != '-')
1189 fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
1190 package_name, long_opt, short_opt,
1191 (additional_error ? additional_error : ""));
1193 fprintf (stderr, "%s: `--%s' option given more than once%s\n",
1194 package_name, long_opt,
1195 (additional_error ? additional_error : ""));
1196 return 1; /* failure */
1199 FIX_UNUSED (default_value);
1201 if (field_given && *field_given && ! override)
1207 if (possible_values)
1208 val = possible_values[found];
1212 *((int *)field) = !*((int *)field);
1215 if (val) *((int *)field) = strtol (val, &stop_char, 0);
1218 if (val) *((float *)field) = (float)strtod (val, &stop_char);
1221 if (val) *((double *)field) = strtod (val, &stop_char);
1225 string_field = (char **)field;
1226 if (!no_free && *string_field)
1227 free (*string_field); /* free previous string */
1228 *string_field = gengetopt_strdup (val);
1235 /* check numeric conversion */
1240 if (val && !(stop_char && *stop_char == '\0')) {
1241 fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
1242 return 1; /* failure */
1249 /* store the original value */
1255 if (value && orig_field) {
1257 *orig_field = value;
1260 free (*orig_field); /* free previous string */
1261 *orig_field = gengetopt_strdup (value);
1271 RNALalifold_cmdline_parser_internal (
1272 int argc, char **argv, struct RNALalifold_args_info *args_info,
1273 struct RNALalifold_cmdline_parser_params *params, const char *additional_error)
1275 int c; /* Character of the parsed option. */
1278 struct RNALalifold_args_info local_args_info;
1283 int check_ambiguity;
1290 package_name = argv[0];
1292 override = params->override;
1293 initialize = params->initialize;
1294 check_required = params->check_required;
1295 check_ambiguity = params->check_ambiguity;
1298 RNALalifold_cmdline_parser_init (args_info);
1300 RNALalifold_cmdline_parser_init (&local_args_info);
1304 opterr = params->print_errors;
1309 int option_index = 0;
1311 static struct option long_options[] = {
1312 { "help", 0, NULL, 'h' },
1313 { "detailed-help", 0, NULL, 0 },
1314 { "full-help", 0, NULL, 0 },
1315 { "version", 0, NULL, 'V' },
1316 { "span", 1, NULL, 'L' },
1317 { "csv", 0, NULL, 0 },
1318 { "partfunc", 2, NULL, 'p' },
1319 { "cutoff", 1, NULL, 'c' },
1320 { "pfScale", 1, NULL, 'S' },
1321 { "mis", 0, NULL, 0 },
1322 { "temp", 1, NULL, 'T' },
1323 { "noTetra", 0, NULL, '4' },
1324 { "dangles", 1, NULL, 'd' },
1325 { "noLP", 0, NULL, 0 },
1326 { "noGU", 0, NULL, 0 },
1327 { "noClosingGU", 0, NULL, 0 },
1328 { "paramFile", 1, NULL, 'P' },
1329 { "nsp", 1, NULL, 0 },
1330 { "energyModel", 1, NULL, 'e' },
1331 { "cfactor", 1, NULL, 0 },
1332 { "nfactor", 1, NULL, 0 },
1333 { "ribosum_file", 1, NULL, 'R' },
1334 { "ribosum_scoring", 0, NULL, 'r' },
1338 custom_optarg = optarg;
1339 custom_optind = optind;
1340 custom_opterr = opterr;
1341 custom_optopt = optopt;
1343 c = custom_getopt_long (argc, argv, "hVL:p::c:S:T:4d:P:e:R:r", long_options, &option_index);
1345 optarg = custom_optarg;
1346 optind = custom_optind;
1347 opterr = custom_opterr;
1348 optopt = custom_optopt;
1350 if (c == -1) break; /* Exit from `while (1)' loop. */
1354 case 'h': /* Print help and exit. */
1355 RNALalifold_cmdline_parser_print_help ();
1356 RNALalifold_cmdline_parser_free (&local_args_info);
1357 exit (EXIT_SUCCESS);
1359 case 'V': /* Print version and exit. */
1360 RNALalifold_cmdline_parser_print_version ();
1361 RNALalifold_cmdline_parser_free (&local_args_info);
1362 exit (EXIT_SUCCESS);
1364 case 'L': /* Set the maximum allowed separation of a base pair to span. I.e. no pairs (i,j) with j-i>span will be allowed.
1369 if (update_arg( (void *)&(args_info->span_arg),
1370 &(args_info->span_orig), &(args_info->span_given),
1371 &(local_args_info.span_given), optarg, 0, "70", ARG_INT,
1372 check_ambiguity, override, 0, 0,
1378 case 'p': /* Calculate the partition function and base pairing probability matrix in addition to the mfe structure.. */
1381 if (update_arg( (void *)&(args_info->partfunc_arg),
1382 &(args_info->partfunc_orig), &(args_info->partfunc_given),
1383 &(local_args_info.partfunc_given), optarg, 0, "1", ARG_INT,
1384 check_ambiguity, override, 0, 0,
1390 case 'c': /* Report only base pairs with an average probability > cutoff in the dot plot
1395 if (update_arg( (void *)&(args_info->cutoff_arg),
1396 &(args_info->cutoff_orig), &(args_info->cutoff_given),
1397 &(local_args_info.cutoff_given), optarg, 0, "0.01", ARG_FLOAT,
1398 check_ambiguity, override, 0, 0,
1404 case 'S': /* In the calculation of the pf use scale*mfe as an estimate for the ensemble free energy (used to avoid overflows).
1408 if (update_arg( (void *)&(args_info->pfScale_arg),
1409 &(args_info->pfScale_orig), &(args_info->pfScale_given),
1410 &(local_args_info.pfScale_given), optarg, 0, 0, ARG_DOUBLE,
1411 check_ambiguity, override, 0, 0,
1417 case 'T': /* Rescale energy parameters to a temperature of temp C. Default is 37C.
1422 if (update_arg( (void *)&(args_info->temp_arg),
1423 &(args_info->temp_orig), &(args_info->temp_given),
1424 &(local_args_info.temp_given), optarg, 0, 0, ARG_DOUBLE,
1425 check_ambiguity, override, 0, 0,
1431 case '4': /* Do not include special tabulated stabilizing energies for tri-, tetra- and hexaloop hairpins. Mostly for testing.
1436 if (update_arg((void *)&(args_info->noTetra_flag), 0, &(args_info->noTetra_given),
1437 &(local_args_info.noTetra_given), optarg, 0, 0, ARG_FLAG,
1438 check_ambiguity, override, 1, 0, "noTetra", '4',
1443 case 'd': /* How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops
1447 if (update_arg( (void *)&(args_info->dangles_arg),
1448 &(args_info->dangles_orig), &(args_info->dangles_given),
1449 &(local_args_info.dangles_given), optarg, 0, "2", ARG_INT,
1450 check_ambiguity, override, 0, 0,
1456 case 'P': /* Read energy parameters from paramfile, instead of using the default parameter set.
1460 if (update_arg( (void *)&(args_info->paramFile_arg),
1461 &(args_info->paramFile_orig), &(args_info->paramFile_given),
1462 &(local_args_info.paramFile_given), optarg, 0, 0, ARG_STRING,
1463 check_ambiguity, override, 0, 0,
1469 case 'e': /* Rarely used option to fold sequences from the artificial ABCD... alphabet, where A pairs B, C-D etc. Use the energy parameters for GC (-e 1) or AU (-e 2) pairs.
1474 if (update_arg( (void *)&(args_info->energyModel_arg),
1475 &(args_info->energyModel_orig), &(args_info->energyModel_given),
1476 &(local_args_info.energyModel_given), optarg, 0, 0, ARG_INT,
1477 check_ambiguity, override, 0, 0,
1483 case 'R': /* use specified Ribosum Matrix instead of normal energy model. Matrixes to use should be 6x6 matrices, the order of the terms is AU, CG, GC, GU, UA, UG.
1488 if (update_arg( (void *)&(args_info->ribosum_file_arg),
1489 &(args_info->ribosum_file_orig), &(args_info->ribosum_file_given),
1490 &(local_args_info.ribosum_file_given), optarg, 0, 0, ARG_STRING,
1491 check_ambiguity, override, 0, 0,
1492 "ribosum_file", 'R',
1497 case 'r': /* use ribosum scoring matrix. The matrix is chosen according to the minimal and maximal pairwise identities of the sequences in the file.
1502 if (update_arg((void *)&(args_info->ribosum_scoring_flag), 0, &(args_info->ribosum_scoring_given),
1503 &(local_args_info.ribosum_scoring_given), optarg, 0, 0, ARG_FLAG,
1504 check_ambiguity, override, 1, 0, "ribosum_scoring", 'r',
1510 case 0: /* Long option with no short option */
1511 if (strcmp (long_options[option_index].name, "detailed-help") == 0) {
1512 RNALalifold_cmdline_parser_print_detailed_help ();
1513 RNALalifold_cmdline_parser_free (&local_args_info);
1514 exit (EXIT_SUCCESS);
1517 if (strcmp (long_options[option_index].name, "full-help") == 0) {
1518 RNALalifold_cmdline_parser_print_full_help ();
1519 RNALalifold_cmdline_parser_free (&local_args_info);
1520 exit (EXIT_SUCCESS);
1523 /* Create comma seperated output (csv)
1526 if (strcmp (long_options[option_index].name, "csv") == 0)
1530 if (update_arg((void *)&(args_info->csv_flag), 0, &(args_info->csv_given),
1531 &(local_args_info.csv_given), optarg, 0, 0, ARG_FLAG,
1532 check_ambiguity, override, 1, 0, "csv", '-',
1537 /* Output \"most informative sequence\" instead of simple consensus: For each column of the alignment output the set of nucleotides with frequence greater than average in IUPAC notation.
1540 else if (strcmp (long_options[option_index].name, "mis") == 0)
1544 if (update_arg((void *)&(args_info->mis_flag), 0, &(args_info->mis_given),
1545 &(local_args_info.mis_given), optarg, 0, 0, ARG_FLAG,
1546 check_ambiguity, override, 1, 0, "mis", '-',
1551 /* Produce structures without lonely pairs (helices of length 1).
1553 else if (strcmp (long_options[option_index].name, "noLP") == 0)
1557 if (update_arg((void *)&(args_info->noLP_flag), 0, &(args_info->noLP_given),
1558 &(local_args_info.noLP_given), optarg, 0, 0, ARG_FLAG,
1559 check_ambiguity, override, 1, 0, "noLP", '-',
1564 /* Do not allow GU pairs
1567 else if (strcmp (long_options[option_index].name, "noGU") == 0)
1571 if (update_arg((void *)&(args_info->noGU_flag), 0, &(args_info->noGU_given),
1572 &(local_args_info.noGU_given), optarg, 0, 0, ARG_FLAG,
1573 check_ambiguity, override, 1, 0, "noGU", '-',
1578 /* Do not allow GU pairs at the end of helices
1581 else if (strcmp (long_options[option_index].name, "noClosingGU") == 0)
1585 if (update_arg((void *)&(args_info->noClosingGU_flag), 0, &(args_info->noClosingGU_given),
1586 &(local_args_info.noClosingGU_given), optarg, 0, 0, ARG_FLAG,
1587 check_ambiguity, override, 1, 0, "noClosingGU", '-',
1592 /* Allow other pairs in addition to the usual AU,GC,and GU pairs.
1594 else if (strcmp (long_options[option_index].name, "nsp") == 0)
1598 if (update_arg( (void *)&(args_info->nsp_arg),
1599 &(args_info->nsp_orig), &(args_info->nsp_given),
1600 &(local_args_info.nsp_given), optarg, 0, 0, ARG_STRING,
1601 check_ambiguity, override, 0, 0,
1607 /* Set the weight of the covariance term in the energy function
1610 else if (strcmp (long_options[option_index].name, "cfactor") == 0)
1614 if (update_arg( (void *)&(args_info->cfactor_arg),
1615 &(args_info->cfactor_orig), &(args_info->cfactor_given),
1616 &(local_args_info.cfactor_given), optarg, 0, "1.0", ARG_DOUBLE,
1617 check_ambiguity, override, 0, 0,
1623 /* Set the penalty for non-compatible sequences in the covariance term of the energy function
1626 else if (strcmp (long_options[option_index].name, "nfactor") == 0)
1630 if (update_arg( (void *)&(args_info->nfactor_arg),
1631 &(args_info->nfactor_orig), &(args_info->nfactor_given),
1632 &(local_args_info.nfactor_given), optarg, 0, "1.0", ARG_DOUBLE,
1633 check_ambiguity, override, 0, 0,
1641 case '?': /* Invalid option. */
1642 /* `getopt_long' already printed an error message. */
1645 default: /* bug: option not considered. */
1646 fprintf (stderr, "%s: option unknown: %c%s\n", RNALALIFOLD_CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1654 RNALalifold_cmdline_parser_release (&local_args_info);
1657 return (EXIT_FAILURE);
1662 int found_prog_name = 0;
1663 /* whether program name, i.e., argv[0], is in the remaining args
1664 (this may happen with some implementations of getopt,
1665 but surely not with the one included by gengetopt) */
1668 args_info->inputs_num = argc - optind - found_prog_name;
1670 (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1671 while (optind < argc)
1672 args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ;
1679 RNALalifold_cmdline_parser_release (&local_args_info);
1680 return (EXIT_FAILURE);