2 File autogenerated by gengetopt version 2.22.5
3 generated with the following command:
4 gengetopt -i RNAplfold.ggo --file-name=RNAplfold_cmdl --include-getopt --default-optional --func-name=RNAplfold_cmdline_parser --arg-struct-name=RNAplfold_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 "RNAplfold_cmdl.h"
27 const char *RNAplfold_args_info_purpose = "calculate locally stable secondary structure - pair probabilities";
29 const char *RNAplfold_args_info_usage = "Usage: RNAplfold [OPTIONS]...";
31 const char *RNAplfold_args_info_description = "Computes local pair probabilities for base pairs with a maximal span of L. The \nprobabilities are averaged over all windows of size L that contain the base \npair. For a sequence of length n and a window size of L the algorithm uses only \nO(n+L*L) memory and O(n*L*L) CPU time. Thus it is practical to \"scan\" very \nlarge genomes for short stable RNA structures.\n";
33 const char *RNAplfold_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 " -W, --winsize=size Average the pair probabilities over windows of \n given size\n\n (default=`70')",
41 " -L, --span=size Set the maximum allowed separation of a base pair \n to span. I.e. no pairs (i,j) with j-i > span \n will be allowed. Defaults to winsize if \n parameter is omitted\n\n",
42 " -c, --cutoff=FLOAT Report only base pairs with an average probability \n > cutoff in the dot plot\n\n (default=`0.01')",
43 " -o, --print_onthefly Save memory by printing out everything during \n computation.\n NOTE: activated per default for sequences over \n 1M bp.\n\n (default=off)",
44 " -u, --ulength=length Compute the mean probability that regions of \n length 1 to a given length are unpaired. Output \n is saved in a _lunp file.\n\n (default=`31')",
45 " -O, --opening_energies Switch output from probabilities to their \n logarithms, which are NOT exactly the mean \n energies needed to the respective stretch of \n bases!\n NOTE: This actives -u option.\n\n (default=off)",
46 " --plex_output Create additional output files for RNAplex.\n\n (default=off)",
47 " --noconv Do not automatically substitude nucleotide \"T\" \n with \"U\"\n\n (default=off)",
49 " -T, --temp=DOUBLE Rescale energy parameters to a temperature of temp \n C. Default is 37C.\n\n",
50 " -4, --noTetra Do not include special tabulated stabilizing \n energies for tri-, tetra- and hexaloop hairpins. \n Mostly for testing.\n\n (default=off)",
51 " -d, --dangles=INT How to treat \"dangling end\" energies for bases \n adjacent to helices in free ends and multi-loops\n (default=`2')",
52 " With -d2 dangling energies will be added for the bases adjacent to a helix on \n both sides in any case.\n\n -d0 ignores dangling ends altogether (mostly for debugging).\n\n",
53 " --noLP Produce structures without lonely pairs (helices \n of length 1).\n (default=off)",
54 " 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",
55 " --noGU Do not allow GU pairs\n\n (default=off)",
56 " --noClosingGU Do not allow GU pairs at the end of helices\n\n (default=off)",
57 " -P, --paramFile=paramfile Read energy parameters from paramfile, instead of \n using the default parameter set.\n",
58 " A sample parameter file should accompany your distribution.\n See the RNAlib documentation for details on the file format.\n\n",
59 " -b, --binaries Output accessibility profiles in binary format\n . (default=off)",
60 " The binary files produced by RNAplfold do not need to be parsed by RNAplex, \n so that they are directly loaded into memory. This is useful when large \n sequences have to be searched for putative hybridization sites. An other \n advantage of the binary format is the 50% file size decrease.\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 (-e \n 1) or AU (-e 2) pairs.\n\n",
64 " --betaScale=DOUBLE Set the scaling of the Boltzmann factors\n (default=`1.')",
65 " The argument provided with this option enables to scale the thermodynamic \n temperature used in the Boltzmann factors independently from the temperature \n used to scale the individual energy contributions of the loop types. The \n Boltzmann factors then become exp(-dG/(kT*betaScale)) where k is the \n Boltzmann constant, dG the free energy contribution of the state and T the \n absolute temperature.\n\n",
66 "\nIf in doubt our program is right, nature is at fault.\nComments should be sent to rna@tbi.univie.ac.at.\n",
70 init_full_help_array(void)
72 RNAplfold_args_info_full_help[0] = RNAplfold_args_info_detailed_help[0];
73 RNAplfold_args_info_full_help[1] = RNAplfold_args_info_detailed_help[1];
74 RNAplfold_args_info_full_help[2] = RNAplfold_args_info_detailed_help[2];
75 RNAplfold_args_info_full_help[3] = RNAplfold_args_info_detailed_help[3];
76 RNAplfold_args_info_full_help[4] = RNAplfold_args_info_detailed_help[4];
77 RNAplfold_args_info_full_help[5] = RNAplfold_args_info_detailed_help[5];
78 RNAplfold_args_info_full_help[6] = RNAplfold_args_info_detailed_help[6];
79 RNAplfold_args_info_full_help[7] = RNAplfold_args_info_detailed_help[7];
80 RNAplfold_args_info_full_help[8] = RNAplfold_args_info_detailed_help[8];
81 RNAplfold_args_info_full_help[9] = RNAplfold_args_info_detailed_help[9];
82 RNAplfold_args_info_full_help[10] = RNAplfold_args_info_detailed_help[10];
83 RNAplfold_args_info_full_help[11] = RNAplfold_args_info_detailed_help[11];
84 RNAplfold_args_info_full_help[12] = RNAplfold_args_info_detailed_help[12];
85 RNAplfold_args_info_full_help[13] = RNAplfold_args_info_detailed_help[13];
86 RNAplfold_args_info_full_help[14] = RNAplfold_args_info_detailed_help[14];
87 RNAplfold_args_info_full_help[15] = RNAplfold_args_info_detailed_help[15];
88 RNAplfold_args_info_full_help[16] = RNAplfold_args_info_detailed_help[16];
89 RNAplfold_args_info_full_help[17] = RNAplfold_args_info_detailed_help[17];
90 RNAplfold_args_info_full_help[18] = RNAplfold_args_info_detailed_help[19];
91 RNAplfold_args_info_full_help[19] = RNAplfold_args_info_detailed_help[21];
92 RNAplfold_args_info_full_help[20] = RNAplfold_args_info_detailed_help[22];
93 RNAplfold_args_info_full_help[21] = RNAplfold_args_info_detailed_help[23];
94 RNAplfold_args_info_full_help[22] = RNAplfold_args_info_detailed_help[25];
95 RNAplfold_args_info_full_help[23] = RNAplfold_args_info_detailed_help[27];
96 RNAplfold_args_info_full_help[24] = RNAplfold_args_info_detailed_help[29];
97 RNAplfold_args_info_full_help[25] = RNAplfold_args_info_detailed_help[30];
98 RNAplfold_args_info_full_help[26] = RNAplfold_args_info_detailed_help[32];
99 RNAplfold_args_info_full_help[27] = 0;
103 const char *RNAplfold_args_info_full_help[28];
106 init_help_array(void)
108 RNAplfold_args_info_help[0] = RNAplfold_args_info_detailed_help[0];
109 RNAplfold_args_info_help[1] = RNAplfold_args_info_detailed_help[1];
110 RNAplfold_args_info_help[2] = RNAplfold_args_info_detailed_help[2];
111 RNAplfold_args_info_help[3] = RNAplfold_args_info_detailed_help[3];
112 RNAplfold_args_info_help[4] = RNAplfold_args_info_detailed_help[4];
113 RNAplfold_args_info_help[5] = RNAplfold_args_info_detailed_help[5];
114 RNAplfold_args_info_help[6] = RNAplfold_args_info_detailed_help[6];
115 RNAplfold_args_info_help[7] = RNAplfold_args_info_detailed_help[7];
116 RNAplfold_args_info_help[8] = RNAplfold_args_info_detailed_help[8];
117 RNAplfold_args_info_help[9] = RNAplfold_args_info_detailed_help[9];
118 RNAplfold_args_info_help[10] = RNAplfold_args_info_detailed_help[10];
119 RNAplfold_args_info_help[11] = RNAplfold_args_info_detailed_help[11];
120 RNAplfold_args_info_help[12] = RNAplfold_args_info_detailed_help[13];
121 RNAplfold_args_info_help[13] = RNAplfold_args_info_detailed_help[14];
122 RNAplfold_args_info_help[14] = RNAplfold_args_info_detailed_help[15];
123 RNAplfold_args_info_help[15] = RNAplfold_args_info_detailed_help[16];
124 RNAplfold_args_info_help[16] = RNAplfold_args_info_detailed_help[17];
125 RNAplfold_args_info_help[17] = RNAplfold_args_info_detailed_help[19];
126 RNAplfold_args_info_help[18] = RNAplfold_args_info_detailed_help[21];
127 RNAplfold_args_info_help[19] = RNAplfold_args_info_detailed_help[22];
128 RNAplfold_args_info_help[20] = RNAplfold_args_info_detailed_help[23];
129 RNAplfold_args_info_help[21] = RNAplfold_args_info_detailed_help[25];
130 RNAplfold_args_info_help[22] = RNAplfold_args_info_detailed_help[32];
131 RNAplfold_args_info_help[23] = 0;
135 const char *RNAplfold_args_info_help[24];
143 } RNAplfold_cmdline_parser_arg_type;
146 void clear_given (struct RNAplfold_args_info *args_info);
148 void clear_args (struct RNAplfold_args_info *args_info);
151 RNAplfold_cmdline_parser_internal (int argc, char **argv, struct RNAplfold_args_info *args_info,
152 struct RNAplfold_cmdline_parser_params *params, const char *additional_error);
156 gengetopt_strdup (const char *s);
159 void clear_given (struct RNAplfold_args_info *args_info)
161 args_info->help_given = 0 ;
162 args_info->detailed_help_given = 0 ;
163 args_info->full_help_given = 0 ;
164 args_info->version_given = 0 ;
165 args_info->winsize_given = 0 ;
166 args_info->span_given = 0 ;
167 args_info->cutoff_given = 0 ;
168 args_info->print_onthefly_given = 0 ;
169 args_info->ulength_given = 0 ;
170 args_info->opening_energies_given = 0 ;
171 args_info->plex_output_given = 0 ;
172 args_info->noconv_given = 0 ;
173 args_info->temp_given = 0 ;
174 args_info->noTetra_given = 0 ;
175 args_info->dangles_given = 0 ;
176 args_info->noLP_given = 0 ;
177 args_info->noGU_given = 0 ;
178 args_info->noClosingGU_given = 0 ;
179 args_info->paramFile_given = 0 ;
180 args_info->binaries_given = 0 ;
181 args_info->nsp_given = 0 ;
182 args_info->energyModel_given = 0 ;
183 args_info->betaScale_given = 0 ;
187 void clear_args (struct RNAplfold_args_info *args_info)
189 FIX_UNUSED (args_info);
190 args_info->winsize_arg = 70;
191 args_info->winsize_orig = NULL;
192 args_info->span_orig = NULL;
193 args_info->cutoff_arg = 0.01;
194 args_info->cutoff_orig = NULL;
195 args_info->print_onthefly_flag = 0;
196 args_info->ulength_arg = 31;
197 args_info->ulength_orig = NULL;
198 args_info->opening_energies_flag = 0;
199 args_info->plex_output_flag = 0;
200 args_info->noconv_flag = 0;
201 args_info->temp_orig = NULL;
202 args_info->noTetra_flag = 0;
203 args_info->dangles_arg = 2;
204 args_info->dangles_orig = NULL;
205 args_info->noLP_flag = 0;
206 args_info->noGU_flag = 0;
207 args_info->noClosingGU_flag = 0;
208 args_info->paramFile_arg = NULL;
209 args_info->paramFile_orig = NULL;
210 args_info->binaries_flag = 0;
211 args_info->nsp_arg = NULL;
212 args_info->nsp_orig = NULL;
213 args_info->energyModel_orig = NULL;
214 args_info->betaScale_arg = 1.;
215 args_info->betaScale_orig = NULL;
220 void init_args_info(struct RNAplfold_args_info *args_info)
222 init_full_help_array();
224 args_info->help_help = RNAplfold_args_info_detailed_help[0] ;
225 args_info->detailed_help_help = RNAplfold_args_info_detailed_help[1] ;
226 args_info->full_help_help = RNAplfold_args_info_detailed_help[2] ;
227 args_info->version_help = RNAplfold_args_info_detailed_help[3] ;
228 args_info->winsize_help = RNAplfold_args_info_detailed_help[6] ;
229 args_info->span_help = RNAplfold_args_info_detailed_help[7] ;
230 args_info->cutoff_help = RNAplfold_args_info_detailed_help[8] ;
231 args_info->print_onthefly_help = RNAplfold_args_info_detailed_help[9] ;
232 args_info->ulength_help = RNAplfold_args_info_detailed_help[10] ;
233 args_info->opening_energies_help = RNAplfold_args_info_detailed_help[11] ;
234 args_info->plex_output_help = RNAplfold_args_info_detailed_help[12] ;
235 args_info->noconv_help = RNAplfold_args_info_detailed_help[13] ;
236 args_info->temp_help = RNAplfold_args_info_detailed_help[15] ;
237 args_info->noTetra_help = RNAplfold_args_info_detailed_help[16] ;
238 args_info->dangles_help = RNAplfold_args_info_detailed_help[17] ;
239 args_info->noLP_help = RNAplfold_args_info_detailed_help[19] ;
240 args_info->noGU_help = RNAplfold_args_info_detailed_help[21] ;
241 args_info->noClosingGU_help = RNAplfold_args_info_detailed_help[22] ;
242 args_info->paramFile_help = RNAplfold_args_info_detailed_help[23] ;
243 args_info->binaries_help = RNAplfold_args_info_detailed_help[25] ;
244 args_info->nsp_help = RNAplfold_args_info_detailed_help[27] ;
245 args_info->energyModel_help = RNAplfold_args_info_detailed_help[29] ;
246 args_info->betaScale_help = RNAplfold_args_info_detailed_help[30] ;
251 RNAplfold_cmdline_parser_print_version (void)
254 (strlen(RNAPLFOLD_CMDLINE_PARSER_PACKAGE_NAME) ? RNAPLFOLD_CMDLINE_PARSER_PACKAGE_NAME : RNAPLFOLD_CMDLINE_PARSER_PACKAGE),
255 RNAPLFOLD_CMDLINE_PARSER_VERSION);
258 static void print_help_common(void) {
259 RNAplfold_cmdline_parser_print_version ();
261 if (strlen(RNAplfold_args_info_purpose) > 0)
262 printf("\n%s\n", RNAplfold_args_info_purpose);
264 if (strlen(RNAplfold_args_info_usage) > 0)
265 printf("\n%s\n", RNAplfold_args_info_usage);
269 if (strlen(RNAplfold_args_info_description) > 0)
270 printf("%s\n\n", RNAplfold_args_info_description);
274 RNAplfold_cmdline_parser_print_help (void)
278 while (RNAplfold_args_info_help[i])
279 printf("%s\n", RNAplfold_args_info_help[i++]);
283 RNAplfold_cmdline_parser_print_full_help (void)
287 while (RNAplfold_args_info_full_help[i])
288 printf("%s\n", RNAplfold_args_info_full_help[i++]);
292 RNAplfold_cmdline_parser_print_detailed_help (void)
296 while (RNAplfold_args_info_detailed_help[i])
297 printf("%s\n", RNAplfold_args_info_detailed_help[i++]);
301 RNAplfold_cmdline_parser_init (struct RNAplfold_args_info *args_info)
303 clear_given (args_info);
304 clear_args (args_info);
305 init_args_info (args_info);
309 RNAplfold_cmdline_parser_params_init(struct RNAplfold_cmdline_parser_params *params)
313 params->override = 0;
314 params->initialize = 1;
315 params->check_required = 1;
316 params->check_ambiguity = 0;
317 params->print_errors = 1;
321 struct RNAplfold_cmdline_parser_params *
322 RNAplfold_cmdline_parser_params_create(void)
324 struct RNAplfold_cmdline_parser_params *params =
325 (struct RNAplfold_cmdline_parser_params *)malloc(sizeof(struct RNAplfold_cmdline_parser_params));
326 RNAplfold_cmdline_parser_params_init(params);
331 free_string_field (char **s)
342 RNAplfold_cmdline_parser_release (struct RNAplfold_args_info *args_info)
345 free_string_field (&(args_info->winsize_orig));
346 free_string_field (&(args_info->span_orig));
347 free_string_field (&(args_info->cutoff_orig));
348 free_string_field (&(args_info->ulength_orig));
349 free_string_field (&(args_info->temp_orig));
350 free_string_field (&(args_info->dangles_orig));
351 free_string_field (&(args_info->paramFile_arg));
352 free_string_field (&(args_info->paramFile_orig));
353 free_string_field (&(args_info->nsp_arg));
354 free_string_field (&(args_info->nsp_orig));
355 free_string_field (&(args_info->energyModel_orig));
356 free_string_field (&(args_info->betaScale_orig));
360 clear_given (args_info);
365 write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
369 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
371 fprintf(outfile, "%s\n", opt);
377 RNAplfold_cmdline_parser_dump(FILE *outfile, struct RNAplfold_args_info *args_info)
383 fprintf (stderr, "%s: cannot dump options to stream\n", RNAPLFOLD_CMDLINE_PARSER_PACKAGE);
387 if (args_info->help_given)
388 write_into_file(outfile, "help", 0, 0 );
389 if (args_info->detailed_help_given)
390 write_into_file(outfile, "detailed-help", 0, 0 );
391 if (args_info->full_help_given)
392 write_into_file(outfile, "full-help", 0, 0 );
393 if (args_info->version_given)
394 write_into_file(outfile, "version", 0, 0 );
395 if (args_info->winsize_given)
396 write_into_file(outfile, "winsize", args_info->winsize_orig, 0);
397 if (args_info->span_given)
398 write_into_file(outfile, "span", args_info->span_orig, 0);
399 if (args_info->cutoff_given)
400 write_into_file(outfile, "cutoff", args_info->cutoff_orig, 0);
401 if (args_info->print_onthefly_given)
402 write_into_file(outfile, "print_onthefly", 0, 0 );
403 if (args_info->ulength_given)
404 write_into_file(outfile, "ulength", args_info->ulength_orig, 0);
405 if (args_info->opening_energies_given)
406 write_into_file(outfile, "opening_energies", 0, 0 );
407 if (args_info->plex_output_given)
408 write_into_file(outfile, "plex_output", 0, 0 );
409 if (args_info->noconv_given)
410 write_into_file(outfile, "noconv", 0, 0 );
411 if (args_info->temp_given)
412 write_into_file(outfile, "temp", args_info->temp_orig, 0);
413 if (args_info->noTetra_given)
414 write_into_file(outfile, "noTetra", 0, 0 );
415 if (args_info->dangles_given)
416 write_into_file(outfile, "dangles", args_info->dangles_orig, 0);
417 if (args_info->noLP_given)
418 write_into_file(outfile, "noLP", 0, 0 );
419 if (args_info->noGU_given)
420 write_into_file(outfile, "noGU", 0, 0 );
421 if (args_info->noClosingGU_given)
422 write_into_file(outfile, "noClosingGU", 0, 0 );
423 if (args_info->paramFile_given)
424 write_into_file(outfile, "paramFile", args_info->paramFile_orig, 0);
425 if (args_info->binaries_given)
426 write_into_file(outfile, "binaries", 0, 0 );
427 if (args_info->nsp_given)
428 write_into_file(outfile, "nsp", args_info->nsp_orig, 0);
429 if (args_info->energyModel_given)
430 write_into_file(outfile, "energyModel", args_info->energyModel_orig, 0);
431 if (args_info->betaScale_given)
432 write_into_file(outfile, "betaScale", args_info->betaScale_orig, 0);
440 RNAplfold_cmdline_parser_file_save(const char *filename, struct RNAplfold_args_info *args_info)
445 outfile = fopen(filename, "w");
449 fprintf (stderr, "%s: cannot open file for writing: %s\n", RNAPLFOLD_CMDLINE_PARSER_PACKAGE, filename);
453 i = RNAplfold_cmdline_parser_dump(outfile, args_info);
460 RNAplfold_cmdline_parser_free (struct RNAplfold_args_info *args_info)
462 RNAplfold_cmdline_parser_release (args_info);
465 /** @brief replacement of strdup, which is not standard */
467 gengetopt_strdup (const char *s)
473 result = (char*)malloc(strlen(s) + 1);
474 if (result == (char*)0)
481 RNAplfold_cmdline_parser (int argc, char **argv, struct RNAplfold_args_info *args_info)
483 return RNAplfold_cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
487 RNAplfold_cmdline_parser_ext (int argc, char **argv, struct RNAplfold_args_info *args_info,
488 struct RNAplfold_cmdline_parser_params *params)
491 result = RNAplfold_cmdline_parser_internal (argc, argv, args_info, params, 0);
493 if (result == EXIT_FAILURE)
495 RNAplfold_cmdline_parser_free (args_info);
503 RNAplfold_cmdline_parser2 (int argc, char **argv, struct RNAplfold_args_info *args_info, int override, int initialize, int check_required)
506 struct RNAplfold_cmdline_parser_params params;
508 params.override = override;
509 params.initialize = initialize;
510 params.check_required = check_required;
511 params.check_ambiguity = 0;
512 params.print_errors = 1;
514 result = RNAplfold_cmdline_parser_internal (argc, argv, args_info, ¶ms, 0);
516 if (result == EXIT_FAILURE)
518 RNAplfold_cmdline_parser_free (args_info);
526 RNAplfold_cmdline_parser_required (struct RNAplfold_args_info *args_info, const char *prog_name)
528 FIX_UNUSED (args_info);
529 FIX_UNUSED (prog_name);
534 * Extracted from the glibc source tree, version 2.3.6
536 * Licensed under the GPL as per the whole glibc source tree.
538 * This file was modified so that getopt_long can be called
539 * many times without risking previous memory to be spoiled.
541 * Modified by Andre Noll and Lorenzo Bettini for use in
542 * GNU gengetopt generated files.
547 * we must include anything we need since this file is not thought to be
548 * inserted in a file already using getopt.h
556 /* has_arg can't be an enum because some compilers complain about
557 type mismatches in all the code that assumes it is an int. */
563 /* This version of `getopt' appears to the caller like standard Unix `getopt'
564 but it behaves differently for the user, since it allows the user
565 to intersperse the options with the other arguments.
567 As `getopt' works, it permutes the elements of ARGV so that,
568 when it is done, all the options precede everything else. Thus
569 all application programs are extended to handle flexible argument order.
572 If the field `flag' is not NULL, it points to a variable that is set
573 to the value given in the field `val' when the option is found, but
574 left unchanged if the option is not found.
576 To have a long-named option do something other than set an `int' to
577 a compiled-in constant, such as set a value from `custom_optarg', set the
578 option's `flag' field to zero and its `val' field to a nonzero
579 value (the equivalent single-letter option character, if there is
580 one). For long options that have a zero `flag' field, `getopt'
581 returns the contents of the `val' field. */
583 /* Names for the values of the `has_arg' field of `struct option'. */
585 #define no_argument 0
588 #ifndef required_argument
589 #define required_argument 1
592 #ifndef optional_argument
593 #define optional_argument 2
596 struct custom_getopt_data {
598 * These have exactly the same meaning as the corresponding global variables,
599 * except that they are used for the reentrant versions of getopt.
606 /* True if the internal members have been initialized. */
610 * The next char to be scanned in the option-element in which the last option
611 * character we returned was found. This allows us to pick up the scan where
612 * we left off. If this is zero, or a null string, it means resume the scan by
613 * advancing to the next ARGV-element.
618 * Describe the part of ARGV that contains non-options that have been skipped.
619 * `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is
620 * the index after the last of them.
627 * the variables optarg, optind, opterr and optopt are renamed with
628 * the custom_ prefix so that they don't interfere with getopt ones.
630 * Moreover they're static so they are visible only from within the
631 * file where this very file will be included.
635 * For communication from `custom_getopt' to the caller. When `custom_getopt' finds an
636 * option that takes an argument, the argument value is returned here.
638 static char *custom_optarg;
641 * Index in ARGV of the next element to be scanned. This is used for
642 * communication to and from the caller and for communication between
643 * successive calls to `custom_getopt'.
645 * On entry to `custom_getopt', 1 means this is the first call; initialize.
647 * When `custom_getopt' returns -1, this is the index of the first of the non-option
648 * elements that the caller should itself scan.
650 * Otherwise, `custom_optind' communicates from one call to the next how much of ARGV
651 * has been scanned so far.
653 * 1003.2 says this must be 1 before any call.
655 static int custom_optind = 1;
658 * Callers store zero here to inhibit the error message for unrecognized
661 static int custom_opterr = 1;
664 * Set to an option character which was unrecognized. This must be initialized
665 * on some systems to avoid linking in the system's own getopt implementation.
667 static int custom_optopt = '?';
670 * Exchange two adjacent subsequences of ARGV. One subsequence is elements
671 * [first_nonopt,last_nonopt) which contains all the non-options that have been
672 * skipped so far. The other is elements [last_nonopt,custom_optind), which contains
673 * all the options processed since those non-options were skipped.
674 * `first_nonopt' and `last_nonopt' are relocated so that they describe the new
675 * indices of the non-options in ARGV after they are moved.
677 static void exchange(char **argv, struct custom_getopt_data *d)
679 int bottom = d->first_nonopt;
680 int middle = d->last_nonopt;
681 int top = d->custom_optind;
685 * Exchange the shorter segment with the far end of the longer segment.
686 * That puts the shorter segment into the right place. It leaves the
687 * longer segment in the right place overall, but it consists of two
688 * parts that need to be swapped next.
690 while (top > middle && middle > bottom) {
691 if (top - middle > middle - bottom) {
692 /* Bottom segment is the short one. */
693 int len = middle - bottom;
696 /* Swap it with the top part of the top segment. */
697 for (i = 0; i < len; i++) {
698 tem = argv[bottom + i];
700 argv[top - (middle - bottom) + i];
701 argv[top - (middle - bottom) + i] = tem;
703 /* Exclude the moved bottom segment from further swapping. */
706 /* Top segment is the short one. */
707 int len = top - middle;
710 /* Swap it with the bottom part of the bottom segment. */
711 for (i = 0; i < len; i++) {
712 tem = argv[bottom + i];
713 argv[bottom + i] = argv[middle + i];
714 argv[middle + i] = tem;
716 /* Exclude the moved top segment from further swapping. */
720 /* Update records for the slots the non-options now occupy. */
721 d->first_nonopt += (d->custom_optind - d->last_nonopt);
722 d->last_nonopt = d->custom_optind;
725 /* Initialize the internal data when the first call is made. */
726 static void custom_getopt_initialize(struct custom_getopt_data *d)
729 * Start processing options with ARGV-element 1 (since ARGV-element 0
730 * is the program name); the sequence of previously skipped non-option
731 * ARGV-elements is empty.
733 d->first_nonopt = d->last_nonopt = d->custom_optind;
738 #define NONOPTION_P (argv[d->custom_optind][0] != '-' || argv[d->custom_optind][1] == '\0')
740 /* return: zero: continue, nonzero: return given value to user */
741 static int shuffle_argv(int argc, char *const *argv,const struct option *longopts,
742 struct custom_getopt_data *d)
745 * Give FIRST_NONOPT & LAST_NONOPT rational values if CUSTOM_OPTIND has been
746 * moved back by the user (who may also have changed the arguments).
748 if (d->last_nonopt > d->custom_optind)
749 d->last_nonopt = d->custom_optind;
750 if (d->first_nonopt > d->custom_optind)
751 d->first_nonopt = d->custom_optind;
753 * If we have just processed some options following some
754 * non-options, exchange them so that the options come first.
756 if (d->first_nonopt != d->last_nonopt &&
757 d->last_nonopt != d->custom_optind)
758 exchange((char **) argv, d);
759 else if (d->last_nonopt != d->custom_optind)
760 d->first_nonopt = d->custom_optind;
762 * Skip any additional non-options and extend the range of
763 * non-options previously skipped.
765 while (d->custom_optind < argc && NONOPTION_P)
767 d->last_nonopt = d->custom_optind;
769 * The special ARGV-element `--' means premature end of options. Skip
770 * it like a null option, then exchange with previous non-options as if
771 * it were an option, then skip everything else like a non-option.
773 if (d->custom_optind != argc && !strcmp(argv[d->custom_optind], "--")) {
775 if (d->first_nonopt != d->last_nonopt
776 && d->last_nonopt != d->custom_optind)
777 exchange((char **) argv, d);
778 else if (d->first_nonopt == d->last_nonopt)
779 d->first_nonopt = d->custom_optind;
780 d->last_nonopt = argc;
781 d->custom_optind = argc;
784 * If we have done all the ARGV-elements, stop the scan and back over
785 * any non-options that we skipped and permuted.
787 if (d->custom_optind == argc) {
789 * Set the next-arg-index to point at the non-options that we
790 * previously skipped, so the caller will digest them.
792 if (d->first_nonopt != d->last_nonopt)
793 d->custom_optind = d->first_nonopt;
797 * If we have come to a non-option and did not permute it, either stop
798 * the scan or describe it to the caller and pass it by.
801 d->custom_optarg = argv[d->custom_optind++];
805 * We have found another option-ARGV-element. Skip the initial
808 d->nextchar = (argv[d->custom_optind] + 1 + (longopts != NULL && argv[d->custom_optind][1] == '-'));
813 * Check whether the ARGV-element is a long option.
815 * If there's a long option "fubar" and the ARGV-element is "-fu", consider
816 * that an abbreviation of the long option, just like "--fu", and not "-f" with
819 * This distinction seems to be the most useful approach.
822 static int check_long_opt(int argc, char *const *argv, const char *optstring,
823 const struct option *longopts, int *longind,
824 int print_errors, struct custom_getopt_data *d)
827 const struct option *p;
828 const struct option *pfound = NULL;
834 for (nameend = d->nextchar; *nameend && *nameend != '='; nameend++)
837 /* Test all long options for either exact match or abbreviated matches */
838 for (p = longopts, option_index = 0; p->name; p++, option_index++)
839 if (!strncmp(p->name, d->nextchar, nameend - d->nextchar)) {
840 if ((unsigned int) (nameend - d->nextchar)
841 == (unsigned int) strlen(p->name)) {
842 /* Exact match found. */
844 indfound = option_index;
847 } else if (pfound == NULL) {
848 /* First nonexact match found. */
850 indfound = option_index;
851 } else if (pfound->has_arg != p->has_arg
852 || pfound->flag != p->flag
853 || pfound->val != p->val)
854 /* Second or later nonexact match found. */
857 if (ambig && !exact) {
860 "%s: option `%s' is ambiguous\n",
861 argv[0], argv[d->custom_optind]);
863 d->nextchar += strlen(d->nextchar);
865 d->custom_optopt = 0;
869 option_index = indfound;
872 if (pfound->has_arg != no_argument)
873 d->custom_optarg = nameend + 1;
876 if (argv[d->custom_optind - 1][1] == '-') {
878 fprintf(stderr, "%s: option `--%s' doesn't allow an argument\n",
879 argv[0], pfound->name);
881 /* +option or -option */
882 fprintf(stderr, "%s: option `%c%s' doesn't allow an argument\n",
883 argv[0], argv[d->custom_optind - 1][0], pfound->name);
887 d->nextchar += strlen(d->nextchar);
888 d->custom_optopt = pfound->val;
891 } else if (pfound->has_arg == required_argument) {
892 if (d->custom_optind < argc)
893 d->custom_optarg = argv[d->custom_optind++];
897 "%s: option `%s' requires an argument\n",
899 argv[d->custom_optind - 1]);
901 d->nextchar += strlen(d->nextchar);
902 d->custom_optopt = pfound->val;
903 return optstring[0] == ':' ? ':' : '?';
906 d->nextchar += strlen(d->nextchar);
908 *longind = option_index;
910 *(pfound->flag) = pfound->val;
916 * Can't find it as a long option. If this is not getopt_long_only, or
917 * the option starts with '--' or is not a valid short option, then
918 * it's an error. Otherwise interpret it as a short option.
921 if (argv[d->custom_optind][1] == '-') {
924 "%s: unrecognized option `--%s'\n",
925 argv[0], d->nextchar);
927 /* +option or -option */
929 "%s: unrecognized option `%c%s'\n",
930 argv[0], argv[d->custom_optind][0],
934 d->nextchar = (char *) "";
936 d->custom_optopt = 0;
940 static int check_short_opt(int argc, char *const *argv, const char *optstring,
941 int print_errors, struct custom_getopt_data *d)
943 char c = *d->nextchar++;
944 const char *temp = strchr(optstring, c);
946 /* Increment `custom_optind' when we start to process its last character. */
947 if (*d->nextchar == '\0')
949 if (!temp || c == ':') {
951 fprintf(stderr, "%s: invalid option -- %c\n", argv[0], c);
953 d->custom_optopt = c;
956 if (temp[1] == ':') {
957 if (temp[2] == ':') {
958 /* This is an option that accepts an argument optionally. */
959 if (*d->nextchar != '\0') {
960 d->custom_optarg = d->nextchar;
963 d->custom_optarg = NULL;
966 /* This is an option that requires an argument. */
967 if (*d->nextchar != '\0') {
968 d->custom_optarg = d->nextchar;
970 * If we end this ARGV-element by taking the
971 * rest as an arg, we must advance to the next
975 } else if (d->custom_optind == argc) {
978 "%s: option requires an argument -- %c\n",
981 d->custom_optopt = c;
982 if (optstring[0] == ':')
988 * We already incremented `custom_optind' once;
989 * increment it again when taking next ARGV-elt
992 d->custom_optarg = argv[d->custom_optind++];
1000 * Scan elements of ARGV for option characters given in OPTSTRING.
1002 * If an element of ARGV starts with '-', and is not exactly "-" or "--",
1003 * then it is an option element. The characters of this element
1004 * (aside from the initial '-') are option characters. If `getopt'
1005 * is called repeatedly, it returns successively each of the option characters
1006 * from each of the option elements.
1008 * If `getopt' finds another option character, it returns that character,
1009 * updating `custom_optind' and `nextchar' so that the next call to `getopt' can
1010 * resume the scan with the following option character or ARGV-element.
1012 * If there are no more option characters, `getopt' returns -1.
1013 * Then `custom_optind' is the index in ARGV of the first ARGV-element
1014 * that is not an option. (The ARGV-elements have been permuted
1015 * so that those that are not options now come last.)
1017 * OPTSTRING is a string containing the legitimate option characters.
1018 * If an option character is seen that is not listed in OPTSTRING,
1019 * return '?' after printing an error message. If you set `custom_opterr' to
1020 * zero, the error message is suppressed but we still return '?'.
1022 * If a char in OPTSTRING is followed by a colon, that means it wants an arg,
1023 * so the following text in the same ARGV-element, or the text of the following
1024 * ARGV-element, is returned in `custom_optarg'. Two colons mean an option that
1025 * wants an optional arg; if there is text in the current ARGV-element,
1026 * it is returned in `custom_optarg', otherwise `custom_optarg' is set to zero.
1028 * If OPTSTRING starts with `-' or `+', it requests different methods of
1029 * handling the non-option ARGV-elements.
1030 * See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
1032 * Long-named options begin with `--' instead of `-'.
1033 * Their names may be abbreviated as long as the abbreviation is unique
1034 * or is an exact match for some defined option. If they have an
1035 * argument, it follows the option name in the same ARGV-element, separated
1036 * from the option name by a `=', or else the in next ARGV-element.
1037 * When `getopt' finds a long-named option, it returns 0 if that option's
1038 * `flag' field is nonzero, the value of the option's `val' field
1039 * if the `flag' field is zero.
1041 * The elements of ARGV aren't really const, because we permute them.
1042 * But we pretend they're const in the prototype to be compatible
1043 * with other systems.
1045 * LONGOPTS is a vector of `struct option' terminated by an
1046 * element containing a name which is zero.
1048 * LONGIND returns the index in LONGOPT of the long-named option found.
1049 * It is only valid when a long-named option has been found by the most
1052 * Return the option character from OPTS just read. Return -1 when there are
1053 * no more options. For unrecognized options, or options missing arguments,
1054 * `custom_optopt' is set to the option letter, and '?' is returned.
1056 * The OPTS string is a list of characters which are recognized option letters,
1057 * optionally followed by colons, specifying that that letter takes an
1058 * argument, to be placed in `custom_optarg'.
1060 * If a letter in OPTS is followed by two colons, its argument is optional.
1061 * This behavior is specific to the GNU `getopt'.
1063 * The argument `--' causes premature termination of argument scanning,
1064 * explicitly telling `getopt' that there are no more options. If OPTS begins
1065 * with `--', then non-option arguments are treated as arguments to the option
1066 * '\0'. This behavior is specific to the GNU `getopt'.
1069 static int getopt_internal_r(int argc, char *const *argv, const char *optstring,
1070 const struct option *longopts, int *longind,
1071 struct custom_getopt_data *d)
1073 int ret, print_errors = d->custom_opterr;
1075 if (optstring[0] == ':')
1079 d->custom_optarg = NULL;
1082 * This is a big difference with GNU getopt, since optind == 0
1083 * means initialization while here 1 means first call.
1085 if (d->custom_optind == 0 || !d->initialized) {
1086 if (d->custom_optind == 0)
1087 d->custom_optind = 1; /* Don't scan ARGV[0], the program name. */
1088 custom_getopt_initialize(d);
1090 if (d->nextchar == NULL || *d->nextchar == '\0') {
1091 ret = shuffle_argv(argc, argv, longopts, d);
1095 if (longopts && (argv[d->custom_optind][1] == '-' ))
1096 return check_long_opt(argc, argv, optstring, longopts,
1097 longind, print_errors, d);
1098 return check_short_opt(argc, argv, optstring, print_errors, d);
1101 static int custom_getopt_internal(int argc, char *const *argv, const char *optstring,
1102 const struct option *longopts, int *longind)
1105 /* Keep a global copy of all internal members of d */
1106 static struct custom_getopt_data d;
1108 d.custom_optind = custom_optind;
1109 d.custom_opterr = custom_opterr;
1110 result = getopt_internal_r(argc, argv, optstring, longopts,
1112 custom_optind = d.custom_optind;
1113 custom_optarg = d.custom_optarg;
1114 custom_optopt = d.custom_optopt;
1118 static int custom_getopt_long (int argc, char *const *argv, const char *options,
1119 const struct option *long_options, int *opt_index)
1121 return custom_getopt_internal(argc, argv, options, long_options,
1126 static char *package_name = 0;
1129 * @brief updates an option
1130 * @param field the generic pointer to the field to update
1131 * @param orig_field the pointer to the orig field
1132 * @param field_given the pointer to the number of occurrence of this option
1133 * @param prev_given the pointer to the number of occurrence already seen
1134 * @param value the argument for this option (if null no arg was specified)
1135 * @param possible_values the possible values for this option (if specified)
1136 * @param default_value the default value (in case the option only accepts fixed values)
1137 * @param arg_type the type of this option
1138 * @param check_ambiguity @see RNAplfold_cmdline_parser_params.check_ambiguity
1139 * @param override @see RNAplfold_cmdline_parser_params.override
1140 * @param no_free whether to free a possible previous value
1141 * @param multiple_option whether this is a multiple option
1142 * @param long_opt the corresponding long option
1143 * @param short_opt the corresponding short option (or '-' if none)
1144 * @param additional_error possible further error specification
1147 int update_arg(void *field, char **orig_field,
1148 unsigned int *field_given, unsigned int *prev_given,
1149 char *value, const char *possible_values[],
1150 const char *default_value,
1151 RNAplfold_cmdline_parser_arg_type arg_type,
1152 int check_ambiguity, int override,
1153 int no_free, int multiple_option,
1154 const char *long_opt, char short_opt,
1155 const char *additional_error)
1157 char *stop_char = 0;
1158 const char *val = value;
1160 char **string_field;
1166 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
1168 if (short_opt != '-')
1169 fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
1170 package_name, long_opt, short_opt,
1171 (additional_error ? additional_error : ""));
1173 fprintf (stderr, "%s: `--%s' option given more than once%s\n",
1174 package_name, long_opt,
1175 (additional_error ? additional_error : ""));
1176 return 1; /* failure */
1179 FIX_UNUSED (default_value);
1181 if (field_given && *field_given && ! override)
1187 if (possible_values)
1188 val = possible_values[found];
1192 *((int *)field) = !*((int *)field);
1195 if (val) *((int *)field) = strtol (val, &stop_char, 0);
1198 if (val) *((float *)field) = (float)strtod (val, &stop_char);
1201 if (val) *((double *)field) = strtod (val, &stop_char);
1205 string_field = (char **)field;
1206 if (!no_free && *string_field)
1207 free (*string_field); /* free previous string */
1208 *string_field = gengetopt_strdup (val);
1215 /* check numeric conversion */
1220 if (val && !(stop_char && *stop_char == '\0')) {
1221 fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
1222 return 1; /* failure */
1229 /* store the original value */
1235 if (value && orig_field) {
1237 *orig_field = value;
1240 free (*orig_field); /* free previous string */
1241 *orig_field = gengetopt_strdup (value);
1251 RNAplfold_cmdline_parser_internal (
1252 int argc, char **argv, struct RNAplfold_args_info *args_info,
1253 struct RNAplfold_cmdline_parser_params *params, const char *additional_error)
1255 int c; /* Character of the parsed option. */
1258 struct RNAplfold_args_info local_args_info;
1263 int check_ambiguity;
1270 package_name = argv[0];
1272 override = params->override;
1273 initialize = params->initialize;
1274 check_required = params->check_required;
1275 check_ambiguity = params->check_ambiguity;
1278 RNAplfold_cmdline_parser_init (args_info);
1280 RNAplfold_cmdline_parser_init (&local_args_info);
1284 opterr = params->print_errors;
1289 int option_index = 0;
1291 static struct option long_options[] = {
1292 { "help", 0, NULL, 'h' },
1293 { "detailed-help", 0, NULL, 0 },
1294 { "full-help", 0, NULL, 0 },
1295 { "version", 0, NULL, 'V' },
1296 { "winsize", 1, NULL, 'W' },
1297 { "span", 1, NULL, 'L' },
1298 { "cutoff", 1, NULL, 'c' },
1299 { "print_onthefly", 0, NULL, 'o' },
1300 { "ulength", 1, NULL, 'u' },
1301 { "opening_energies", 0, NULL, 'O' },
1302 { "plex_output", 0, NULL, 0 },
1303 { "noconv", 0, NULL, 0 },
1304 { "temp", 1, NULL, 'T' },
1305 { "noTetra", 0, NULL, '4' },
1306 { "dangles", 1, NULL, 'd' },
1307 { "noLP", 0, NULL, 0 },
1308 { "noGU", 0, NULL, 0 },
1309 { "noClosingGU", 0, NULL, 0 },
1310 { "paramFile", 1, NULL, 'P' },
1311 { "binaries", 0, NULL, 'b' },
1312 { "nsp", 1, NULL, 0 },
1313 { "energyModel", 1, NULL, 'e' },
1314 { "betaScale", 1, NULL, 0 },
1318 custom_optarg = optarg;
1319 custom_optind = optind;
1320 custom_opterr = opterr;
1321 custom_optopt = optopt;
1323 c = custom_getopt_long (argc, argv, "hVW:L:c:ou:OT:4d:P:be:", long_options, &option_index);
1325 optarg = custom_optarg;
1326 optind = custom_optind;
1327 opterr = custom_opterr;
1328 optopt = custom_optopt;
1330 if (c == -1) break; /* Exit from `while (1)' loop. */
1334 case 'h': /* Print help and exit. */
1335 RNAplfold_cmdline_parser_print_help ();
1336 RNAplfold_cmdline_parser_free (&local_args_info);
1337 exit (EXIT_SUCCESS);
1339 case 'V': /* Print version and exit. */
1340 RNAplfold_cmdline_parser_print_version ();
1341 RNAplfold_cmdline_parser_free (&local_args_info);
1342 exit (EXIT_SUCCESS);
1344 case 'W': /* Average the pair probabilities over windows of given size
1349 if (update_arg( (void *)&(args_info->winsize_arg),
1350 &(args_info->winsize_orig), &(args_info->winsize_given),
1351 &(local_args_info.winsize_given), optarg, 0, "70", ARG_INT,
1352 check_ambiguity, override, 0, 0,
1358 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. Defaults to winsize if parameter is omitted
1363 if (update_arg( (void *)&(args_info->span_arg),
1364 &(args_info->span_orig), &(args_info->span_given),
1365 &(local_args_info.span_given), optarg, 0, 0, ARG_INT,
1366 check_ambiguity, override, 0, 0,
1372 case 'c': /* Report only base pairs with an average probability > cutoff in the dot plot
1377 if (update_arg( (void *)&(args_info->cutoff_arg),
1378 &(args_info->cutoff_orig), &(args_info->cutoff_given),
1379 &(local_args_info.cutoff_given), optarg, 0, "0.01", ARG_FLOAT,
1380 check_ambiguity, override, 0, 0,
1386 case 'o': /* Save memory by printing out everything during computation.
1387 NOTE: activated per default for sequences over 1M bp.
1392 if (update_arg((void *)&(args_info->print_onthefly_flag), 0, &(args_info->print_onthefly_given),
1393 &(local_args_info.print_onthefly_given), optarg, 0, 0, ARG_FLAG,
1394 check_ambiguity, override, 1, 0, "print_onthefly", 'o',
1399 case 'u': /* Compute the mean probability that regions of length 1 to a given length are unpaired. Output is saved in a _lunp file.
1404 if (update_arg( (void *)&(args_info->ulength_arg),
1405 &(args_info->ulength_orig), &(args_info->ulength_given),
1406 &(local_args_info.ulength_given), optarg, 0, "31", ARG_INT,
1407 check_ambiguity, override, 0, 0,
1413 case 'O': /* Switch output from probabilities to their logarithms, which are NOT exactly the mean energies needed to the respective stretch of bases!
1414 NOTE: This actives -u option.
1419 if (update_arg((void *)&(args_info->opening_energies_flag), 0, &(args_info->opening_energies_given),
1420 &(local_args_info.opening_energies_given), optarg, 0, 0, ARG_FLAG,
1421 check_ambiguity, override, 1, 0, "opening_energies", 'O',
1426 case 'T': /* Rescale energy parameters to a temperature of temp C. Default is 37C.
1431 if (update_arg( (void *)&(args_info->temp_arg),
1432 &(args_info->temp_orig), &(args_info->temp_given),
1433 &(local_args_info.temp_given), optarg, 0, 0, ARG_DOUBLE,
1434 check_ambiguity, override, 0, 0,
1440 case '4': /* Do not include special tabulated stabilizing energies for tri-, tetra- and hexaloop hairpins. Mostly for testing.
1445 if (update_arg((void *)&(args_info->noTetra_flag), 0, &(args_info->noTetra_given),
1446 &(local_args_info.noTetra_given), optarg, 0, 0, ARG_FLAG,
1447 check_ambiguity, override, 1, 0, "noTetra", '4',
1452 case 'd': /* How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops
1456 if (update_arg( (void *)&(args_info->dangles_arg),
1457 &(args_info->dangles_orig), &(args_info->dangles_given),
1458 &(local_args_info.dangles_given), optarg, 0, "2", ARG_INT,
1459 check_ambiguity, override, 0, 0,
1465 case 'P': /* Read energy parameters from paramfile, instead of using the default parameter set.
1469 if (update_arg( (void *)&(args_info->paramFile_arg),
1470 &(args_info->paramFile_orig), &(args_info->paramFile_given),
1471 &(local_args_info.paramFile_given), optarg, 0, 0, ARG_STRING,
1472 check_ambiguity, override, 0, 0,
1478 case 'b': /* Output accessibility profiles in binary format
1482 if (update_arg((void *)&(args_info->binaries_flag), 0, &(args_info->binaries_given),
1483 &(local_args_info.binaries_given), optarg, 0, 0, ARG_FLAG,
1484 check_ambiguity, override, 1, 0, "binaries", 'b',
1489 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.
1494 if (update_arg( (void *)&(args_info->energyModel_arg),
1495 &(args_info->energyModel_orig), &(args_info->energyModel_given),
1496 &(local_args_info.energyModel_given), optarg, 0, 0, ARG_INT,
1497 check_ambiguity, override, 0, 0,
1504 case 0: /* Long option with no short option */
1505 if (strcmp (long_options[option_index].name, "detailed-help") == 0) {
1506 RNAplfold_cmdline_parser_print_detailed_help ();
1507 RNAplfold_cmdline_parser_free (&local_args_info);
1508 exit (EXIT_SUCCESS);
1511 if (strcmp (long_options[option_index].name, "full-help") == 0) {
1512 RNAplfold_cmdline_parser_print_full_help ();
1513 RNAplfold_cmdline_parser_free (&local_args_info);
1514 exit (EXIT_SUCCESS);
1517 /* Create additional output files for RNAplex.
1520 if (strcmp (long_options[option_index].name, "plex_output") == 0)
1524 if (update_arg((void *)&(args_info->plex_output_flag), 0, &(args_info->plex_output_given),
1525 &(local_args_info.plex_output_given), optarg, 0, 0, ARG_FLAG,
1526 check_ambiguity, override, 1, 0, "plex_output", '-',
1531 /* Do not automatically substitude nucleotide \"T\" with \"U\"
1534 else if (strcmp (long_options[option_index].name, "noconv") == 0)
1538 if (update_arg((void *)&(args_info->noconv_flag), 0, &(args_info->noconv_given),
1539 &(local_args_info.noconv_given), optarg, 0, 0, ARG_FLAG,
1540 check_ambiguity, override, 1, 0, "noconv", '-',
1545 /* Produce structures without lonely pairs (helices of length 1).
1547 else if (strcmp (long_options[option_index].name, "noLP") == 0)
1551 if (update_arg((void *)&(args_info->noLP_flag), 0, &(args_info->noLP_given),
1552 &(local_args_info.noLP_given), optarg, 0, 0, ARG_FLAG,
1553 check_ambiguity, override, 1, 0, "noLP", '-',
1558 /* Do not allow GU pairs
1561 else if (strcmp (long_options[option_index].name, "noGU") == 0)
1565 if (update_arg((void *)&(args_info->noGU_flag), 0, &(args_info->noGU_given),
1566 &(local_args_info.noGU_given), optarg, 0, 0, ARG_FLAG,
1567 check_ambiguity, override, 1, 0, "noGU", '-',
1572 /* Do not allow GU pairs at the end of helices
1575 else if (strcmp (long_options[option_index].name, "noClosingGU") == 0)
1579 if (update_arg((void *)&(args_info->noClosingGU_flag), 0, &(args_info->noClosingGU_given),
1580 &(local_args_info.noClosingGU_given), optarg, 0, 0, ARG_FLAG,
1581 check_ambiguity, override, 1, 0, "noClosingGU", '-',
1586 /* Allow other pairs in addition to the usual AU,GC,and GU pairs.
1588 else if (strcmp (long_options[option_index].name, "nsp") == 0)
1592 if (update_arg( (void *)&(args_info->nsp_arg),
1593 &(args_info->nsp_orig), &(args_info->nsp_given),
1594 &(local_args_info.nsp_given), optarg, 0, 0, ARG_STRING,
1595 check_ambiguity, override, 0, 0,
1601 /* Set the scaling of the Boltzmann factors
1603 else if (strcmp (long_options[option_index].name, "betaScale") == 0)
1607 if (update_arg( (void *)&(args_info->betaScale_arg),
1608 &(args_info->betaScale_orig), &(args_info->betaScale_given),
1609 &(local_args_info.betaScale_given), optarg, 0, "1.", ARG_DOUBLE,
1610 check_ambiguity, override, 0, 0,
1618 case '?': /* Invalid option. */
1619 /* `getopt_long' already printed an error message. */
1622 default: /* bug: option not considered. */
1623 fprintf (stderr, "%s: option unknown: %c%s\n", RNAPLFOLD_CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1631 RNAplfold_cmdline_parser_release (&local_args_info);
1634 return (EXIT_FAILURE);
1640 RNAplfold_cmdline_parser_release (&local_args_info);
1641 return (EXIT_FAILURE);