# Name of your program
package "RNAalifold" # don't use package if you're using automake
purpose "calculate secondary structures for a set of aligned RNAs"
usage   "RNAalifold [options] [<input0.aln>] [<input1.aln>]..."

# Version of your program
# version "2.0"   # don't use version if you're using automake


# command line options passed to gengetopt
args "--file-name=RNAalifold_cmdl --include-getopt --default-optional --unamed-opts --func-name=RNAalifold_cmdline_parser --arg-struct-name=RNAalifold_args_info"

description "Read aligned RNA sequences from stdin or file.aln and calculate\
 their minimum free energy (mfe) structure, partition function (pf) and base\
 pairing probability matrix. Currently, input alignments have to be in\
 CLUSTAL, Stockholm, FASTA, or MAF format. The input format must be set\
 manually in interactive mode (default is Clustal), but will be determined\
 automagically from the input file, if not expplicitly set. It returns the\
 mfe structure in bracket notation, its\
 energy, the free energy of the thermodynamic ensemble and the frequency of\
 the mfe structure in the ensemble to stdout.  It also produces Postscript\
 files with plots of the resulting secondary structure graph (\"alirna.ps\")\
 and a \"dot plot\" of the base pairing matrix (\"alidot.ps\"). The file\
 \"alifold.out\" will contain a list of likely pairs sorted by credibility,\
 suitable for viewing  with \"AliDot.pl\". Be warned that output file will\
 overwrite any existing files of the same name.\n\n"

# Options

option  "verbose" v
"Be verbose.\n"
details="Lower the log level setting such that even INFO messages are passed through.\n\n"
flag
off


option  "quiet" q
"Be quiet.\n"
details="This option can be used to minimize the output of additional information\
 and non-severe warnings which otherwise might spam stdout/stderr.\n\n"
flag
off


section "I/O Options"
sectiondesc="Command line options for input and output (pre-)processing\n\n"

option  "input-format"  f
"File format of the input multiple sequence alignment (MSA).\n"
details="If this parameter is set, the input is considered to be in a particular\
 file format. Otherwise, the program tries to determine the file format automatically,\
 if an input file was provided in the set of parameters. In case the input MSA is provided\
 in interactive mode, or from a terminal (TTY), the programs default is to assume\
 CLUSTALW format.\nCurrently, the following formats are available: ClustalW ('C'),\
 Stockholm 1.0 ('S'), FASTA/Pearson ('F'), and MAF ('M').\n\n"
string
typestr="C|S|F|M"
optional

option  "mis"             -
"Output \"most informative sequence\" instead of simple consensus: For each column of the alignment output\
 the set of nucleotides with frequency greater than average in IUPAC notation.\n\n"
flag
off

option  "jobs"  j
"Split batch input into jobs and start processing in parallel using multiple threads. A value of 0\
 indicates to use as many parallel threads as computation cores are available.\n"
details="Default processing of input data is performed in a serial fashion, i.e. one alignment at\
 a time. Using this switch, a user can instead start the computation for many alignments in the\
 input in parallel. RNAalifold will create as many parallel computation slots as specified and\
 assigns input alignments of the input file(s) to the available slots. Note, that this increases\
 memory consumption since input alignments have to be kept in memory until an empty compute slot\
 is available and each running job requires its own dynamic programming matrices.\n\n"
int
default="0"
typestr="number"
argoptional
optional

option  "unordered"  -
"Do not try to keep output in order with input while parallel processing is in place.\n"
details="When parallel input processing (--jobs flag) is enabled, the order in which input\
 is processed depends on the host machines job scheduler. Therefore, any output to stdout\
 or files generated by this program will most likely not follow the order of the corresponding\
 input data set. The default of RNAalifold is to use a specialized data structure to still keep\
 the results output in order with the input data. However, this comes with a trade-off in terms\
 of memory consumption, since all output must be kept in memory for as long as no chunks\
 of consecutive, ordered output are available. By setting this flag, RNAalifold will not buffer\
 individual results but print them as soon as they have been computated.\n\n"
flag
off
hidden
dependon="jobs"
hidden

option  "noconv"  -
"Do not automatically substitute nucleotide \"T\" with \"U\".\n\n"
flag
off

option  "continuous-ids"   n
"Use continuous alignment ID numbering when no alignment ID can be retrieved from input data.\n"
details="Due to its past, RNAalifold produces a specific set of output file names for the first\
 input alignment, \"alirna.ps\", \"alidot.ps\", etc. But for all further alignments in the input, it\
 usually adopts a naming scheme based on IDs, which may be retrieved from the input alignment's\
 meta-data, or generated by a prefix followed by an increasing counter. Setting this flag instructs\
 RNAalifold to use the ID naming scheme also for the first alignment.\n\n"
flag
off

option  "auto-id"  -
"Automatically generate an ID for each alignment.\n"
details="The default mode of RNAalifold is to automatically determine an ID from the input alignment\
 if the input file format allows to do that. Alignment IDs are, for instance, usually given in\
 Stockholm 1.0 formatted input. If this flag is active, RNAalifold ignores any IDs retrieved from the\
 input and automatically generates an ID for each alignment.\n\n"
flag
off

option  "id-prefix" -
"Prefix for automatically generated IDs (as used in output file names).\n"
details="If this parameter is set, each alignment will be prefixed with the\
 provided string. Hence, the output files will obey the following naming\
 scheme: \"prefix_xxxx_ss.ps\" (secondary structure plot), \"prefix_xxxx_dp.ps\"\
 (dot-plot), \"prefix_xxxx_aln.ps\" (annotated alignment), etc. where xxxx\
 is the alignment number beginning with the second alignment in the input.\
 Use this setting in conjunction with the --continuous-ids flag to assign\
 IDs beginning with the first input alignment.\n\n"
string
typestr="STRING"
default="alignment"
optional

option  "id-delim" -
"Change the delimiter between prefix and increasing number for automatically generated IDs (as used in output file names).\n"
details="This parameter can be used to change the default delimiter '_' between\
 the prefix string and the increasing number for automatically generated ID.\n\n"
string
typestr="CHAR"
default="_"
optional
hidden

option  "id-digits"  -
"Specify the number of digits of the counter in automatically generated alignment IDs.\n"
details="When alignments IDs are automatically generated, they receive an increasing number, starting\
 with 1. This number will always be left-padded by leading zeros, such that the number takes up a\
 certain width. Using this parameter, the width can be specified to the users need. We allow\
 numbers in the range [1:18].\n\n"
int
default="4"
optional
hidden

option  "id-start"  -
"Specify the first number in automatically generated alignment IDs.\n"
details="When alignment IDs are automatically generated, they receive an increasing number,\
 usually starting with 1. Using this parameter, the first number can be specified to the users\
 requirements. Note: negative numbers are not allowed.\nNote: Setting this parameter implies\
 continuous alignment IDs, i.e. it activates the --continuous-ids flag.\n\n"
long
default="1"
optional
hidden

option  "filename-delim" -
"Change the delimiting character used in sanitized filenames.\n"
details="This parameter can be used to change the delimiting character used while\
 sanitizing filenames, i.e. replacing invalid characters. Note, that the default\
 delimiter ALWAYS is the first character of the \"ID delimiter\" as supplied through\
 the --id-delim option. If the delimiter is a whitespace character or empty, invalid\
 characters will be simply removed rather than substituted.\
 Currently, we regard the following characters as illegal for use in filenames:\
 backslash '\', slash '/', question mark '?', percent sign '%', asterisk '*', colon ':',\
 pipe symbol '|', double quote '\"', triangular brackets '<' and '>'.\n\n"
string
typestr="CHAR"
default="ID-delimiter"
optional
hidden


option  "log-level" -
"Set log level threshold.\n"
details="By default, any log messages are filtered such that only warnings (level 2) or errors (level 3)\
 are printed. This setting allows for specifying the log level threshold, where higher values result in\
 fewer information. Log-level 5 turns off all messages, even errors and other critical information.\n\n"
int
typestr="level"
default="2"
hidden


option  "log-file" -
"Print log messages to a file instead of stderr.\n"
string
typestr="filename"
default="RNAalifold.log"
argoptional
hidden


option  "log-time" -
"Include time stamp in log messages.\n\n"
flag
off
hidden


option  "log-call" -
"Include file and line of log calling function.\n\n"
flag
off
hidden


option  "benchmark" -
"Perform a prediction performance test (benchmark) based on reference structures taken from the input.\n\n"
flag
off
hidden


option  "bm-output" -
"Store the performance benchmark results in a file.\n\n"
string
typestr="filename"
optional
hidden


option  "bm-output-append" -
"Append performance benchmark data to a file instead of overwriting already existing content.\n\n"
flag
off
dependon="bm-output"
hidden


option  "bm-rm-pk" -
"Remove pseudo-knots from the reference structure before computing benchmark.\n\n"
flag
off
hidden


section "Algorithms"
sectiondesc="Select additional algorithms which should be included in the calculations.\n\n"

option  "partfunc"  p
"Calculate the partition function and base pairing probability matrix in\
 addition to the mfe structure. Default is calculation of mfe structure only.\n"
details="In addition to the MFE structure we print a coarse representation of the pair probabilities in form\
 of a pseudo bracket notation, followed by the ensemble free energy, as well as the centroid structure derived\
 from the pair probabilities together with its free energy and distance to the ensemble. Finally it prints the\
 frequency of the mfe structure.\n\nAn additionally passed value to this option changes the behavior of\
 partition function calculation:\n-p0 deactivates the calculation of the pair probabilities,\
 saving about 50% in runtime. This prints the ensemble free energy 'dG=-kT ln(Z)'.\n\n"
int
default="1"
argoptional
optional

option  "betaScale" -
"Set the scaling of the Boltzmann factors.\n"
details="The argument provided with this option is used to scale the thermodynamic temperature\
 in the Boltzmann factors independently from the temperature of the individual loop energy contributions.\
 The Boltzmann factors then become 'exp(- dG/(kTn*betaScale))' where 'k' is the Boltzmann constant, 'dG'\
 the free energy contribution of the state, 'T' the absolute temperature and 'n' the number of sequences.\n\n"
double
default="1."
optional
dependon="partfunc"
hidden

option  "pfScale" S
"In the calculation of the pf use scale*mfe as an estimate for the ensemble free energy (used to avoid\
 overflows).\n"
details="The default is 1.07, useful values are 1.0 to 1.2. Occasionally needed for long sequences.\n\n"
double
default="1.07"
optional
hidden

option  "MEA"   -
"Compute MEA (maximum expected accuracy) structure.\n"
details="The expected accuracy is computed from the pair probabilities: each base pair '(i,j)' receives\
 a score '2*gamma*p_ij' and the score of an unpaired base is given by the probability of not forming\
 a pair. The parameter gamma tunes the importance of correctly predicted pairs versus unpaired bases.\
 Thus, for small values of gamma the MEA structure will contain only pairs with very high probability.\
 Using --MEA implies -p for computing the pair probabilities.\n\n"
float
typestr="gamma"
default="1."
argoptional
optional

option  "sci" -
"Compute the structure conservation index (SCI) for the MFE consensus structure of the alignment.\n\n"
flag
off

option  "circ"    c
"Assume a circular (instead of linear) RNA molecule.\n\n"
flag
off

option  "bppmThreshold" -
"Set the threshold/cutoff for base pair probabilities included in the postscript output.\n\n"
details="By setting the threshold the base pair probabilities that are included in the\
 output can be varied. By default only those exceeding '1e-6' in probability will be shown as squares\
 in the dot plot. Changing the threshold to any other value allows for increase or decrease of data.\n\n"
double
typestr="cutoff"
optional
default="1e-6"
hidden

option  "gquad" g
"Incoorporate G-Quadruplex formation into the structure prediction algorithm.\n\n"
flag
off

option  "stochBT"         s
"Stochastic backtrack. Compute a certain number of random structures with a probability dependend on the\
 partition function. See -p option in RNAsubopt.\n\n"
int
optional

option  "stochBT_en"      -
"same as -s option but also print out the energies and probabilities of the backtraced structures.\n\n"
int
optional

option "nonRedundant" N
"Enable non-redundant sampling strategy.\n\n"
flag
off


option    "random-seed"  -
"Set the seed for the random number generator\n\n"
int
optional
hidden


section "Structure Constraints"
sectiondesc="Command line options to interact with the structure constraints feature of this program\n\n"

option  "maxBPspan" -
"Set the maximum base pair span.\n\n"
int
default="-1"
optional

option  "constraint"  C
"Calculate structures subject to constraints.\nThe constraining structure will be read from 'stdin',\
 the alignment has to be given as a file name on the command line.\n"
details="The program reads first the\
 sequence, then a string containing constraints on the structure encoded with the symbols:\n\n'.' (no constraint\
 for this base)\n\n'|' (the corresponding base has to be paired\n\n'x' (the base is unpaired)\n\n'<' (base i is paired with\
 a base j>i)\n\n'>' (base i is paired with a base j<i)\n\nand matching brackets '(' ')' (base i pairs base j)\n\nWith the\
 exception of '|', constraints will disallow all pairs conflicting with the constraint. This is usually\
 sufficient to enforce the constraint, but occasionally a base may stay unpaired in spite of constraints. PF\
 folding ignores constraints of type '|'.\n\n"
string
typestr="filename"
default = ""
argoptional

option  "batch"   -
"Use constraints for all alignment records.\n"
details="Usually, constraints provided from input file are only applied to a single sequence alignment. Therefore,\
 RNAalifold will stop its computation and quit after the first input alignment was processed. Using this\
 switch, RNAalifold processes all sequence alignments in the input and applies the same provided constraints to\
 each of them.\n\n"
flag
off
dependon="constraint"
hidden

option  "enforceConstraint" -
"Enforce base pairs given by round brackets '(' ')' in structure constraint.\n\n"
flag
off
dependon="constraint"

option  "SS_cons"  -
"Use consensus structures from Stockholm file ('#=GF SS_cons') as constraint.\n"
details="Stockholm formatted alignment files have the possibility to store a\
 secondary structure string in one of if ('#=GC') column annotation meta tags.\
 The corresponding tag name is usually 'SS_cons', a consensus secondary structure.\
 Activating this flag allows one to use this consensus secondary structure from\
 the input file as structure constraint. Currently, only the following characters are\
 interpreted:\n\n'(' ')' [mathing parenthesis: column i pairs with column j]\n\n'<' '>'\
 [matching angular brackets: column i pairs with column j]\n\nAll other characters\
 are not interpreted (yet).\nNote: Activating this flag implies --constraint.\n\n"
flag
off

option  "shape" -
"Use SHAPE reactivity data to guide structure predictions.\n"
details="Multiple shapefiles for the individual sequences in the alignment may be specified \
 as a comma separated list. An optional association of particular shape files to a specific \
 sequence in the alignment can be expressed by prepending the sequence number to the filename, \
 e.g. \"5=seq5.shape,3=seq3.shape\" will assign the reactivity values from file seq5.shape to \
 the fifth sequence in the alignment, and the values from file seq3.shape to sequence 3. If \
 no assignment is specified, the reactivity values are assigned to corresponding sequences in \
 the order they are given.\n\n"
string
typestr="file1,file2"
multiple(1-)
optional

option  "shapeMethod" -
"Specify the method how to convert SHAPE reactivity data to pseudo energy contributions.\n"
details="Currently, the only data conversion method available is that of to Deigan et al 2009. \
 This method is the default and is recognized by a capital 'D' in the provided parameter, i.e.: \
 --shapeMethod=\"D\" is the default setting. The slope 'm' and the intercept 'b' can be set to a \
 non-default value if necessary. Otherwise m=1.8 and b=-0.6 as stated in the paper mentionen before. \
 To alter these parameters, e.g. m=1.9 and b=-0.7, use a \
 parameter string like this: --shapeMethod=\"Dm1.9b-0.7\". You may also provide only one of the two \
 parameters like: --shapeMethod=\"Dm1.9\" or --shapeMethod=\"Db-0.7\".\n\n"
string
typestr="D[mX][bY]"
dependon="shape"
default="D"
optional
hidden


section "Energy Parameters"
sectiondesc="Energy parameter sets can be adapted or loaded from user-provided input files\n\n"

option  "temp"  T
"Rescale energy parameters to a temperature of temp C. Default is 37C.\n\n"
double
default="37.0"
optional

option  "paramFile" P
"Read energy parameters from paramfile, instead of using the default parameter set.\n"
details="Different sets of energy parameters for RNA and DNA should accompany your distribution.\nSee the\
 RNAlib documentation for details on the file format. The placeholder file name 'DNA' can be used\
 to load DNA parameters without the need to actually specify any input file.\n\n"
string
typestr="paramfile"
optional

option  "noTetra" 4
"Do not include special tabulated stabilizing energies for tri-, tetra- and hexaloop hairpins.\n"
details="Mostly for testing.\n\n"
flag
off
hidden

option  "salt" -
"Set salt concentration in molar (M). Default is 1.021M.\n\n"
double
optional


section "Model Details"
sectiondesc="Tweak the energy model and pairing rules additionally using the following parameters\n\n"

option  "dangles" d
"How to treat \"dangling end\" energies for bases adjacent to helices in free ends and multi-loops.\n"
details="\nWith -d2 dangling energies will be added for the bases adjacent to a helix on both sides
 in any case.\nThe option -d0 ignores dangling ends altogether (mostly for debugging).\n\n"
int
default="2"
optional

option  "noLP"  -
"Produce structures without lonely pairs (helices of length 1).\n"
details="For partition function folding this only disallows pairs that can only occur isolated. Other\
 pairs may still occasionally occur as helices of length 1.\n\n"
flag
off

option  "noGU"  -
"Do not allow GU pairs.\n\n"
flag
off
hidden

option  "noClosingGU" -
"Do not allow GU pairs at the end of helices.\n\n"
flag
off
hidden

option  "cfactor"         -
"Set the weight of the covariance term in the energy function\n\n"
default="1.0"
double
optional

option  "nfactor"         -
"Set the penalty for non-compatible sequences in the covariance term of the energy function\n\n"
default="1.0"
double
optional

option  "endgaps"         E
"Score pairs with endgaps same as gap-gap pairs.\n\n"
flag
off

option  "ribosum_file"    R
"use specified Ribosum Matrix instead of normal energy model.\n"
details="Matrixes to use should be 6x6 matrices, the order of the terms is\
 'AU', 'CG', 'GC', 'GU', 'UA', 'UG'.\n\n"
string
typestr="ribosumfile"
optional

option  "ribosum_scoring" r
"use ribosum scoring matrix.\n"
details="The matrix is chosen according to the minimal and maximal pairwise\
 identities of the sequences in the file.\n\n"
flag
off

option  "old" -
"use old energy evaluation, treating gaps as characters.\n\n"
flag
off

option  "nsp" -
"Allow other pairs in addition to the usual AU,GC,and GU pairs.\n"
details="Its argument is a comma separated list of additionally allowed pairs. If the\
 first character is a \"-\" then AB will imply that AB and BA are allowed pairs, e.g.\
 --nsp=\"-GA\"  will allow GA and AG pairs. Nonstandard pairs are given 0 stacking\
 energy.\n\n"
string
optional
hidden

option  "energyModel" -
"Set energy model.\n"
details="Rarely used option to fold sequences from the artificial ABCD... alphabet, where\
 A pairs B, C-D etc.  Use the energy parameters for GC (--energyModel 1) or AU (--energyModel 2) pairs.\n\n"
int
optional
hidden

option  "helical-rise"  -
"Set the helical rise of the helix in units of Angstrom.\n"
details="Use with caution! This value will be re-set automatically to 3.4 in case DNA\
 parameters are loaded via -P DNA and no further value is provided.\n\n"
float
optional
default="2.8"
hidden

option  "backbone-length"  -
"Set the average backbone length for looped regions in units of Angstrom.\n"
details="Use with caution! This value will be re-set automatically to 6.76 in case DNA\
 parameters are loaded via -P DNA and no further value is provided.\n\n"
float
optional
default="6.0"
hidden


section "Plotting"
sectiondesc="Command line options for changing the default behavior of structure layout and pairing probability plots\n\n"

option  "color"   -
"Produce a colored version of the consensus structure plot \"alirna.ps\" (default b&w only)\n\n"
flag
off

option  "color-threshold" -
"Set the threshold of maximum counter examples for coloring consensus structure plot.\n"
details="Floating point numbers between 0 and 1 are treated as frequencies among all sequences\
in the alignment. All other will be truncated to integer and used as absolute number of counter
examples.\n\n"
float
optional
default="2"
hidden


option  "color-min-sat" -
"Set the minimum saturation for coloring consensus structure plot.\n"
details="Floating point number >= 0 and smaller than 1.\n\n"
float
optional
default="0.2"
hidden


option  "aln"             -
"Produce a colored and structure annotated alignment in PostScript format in the file \"aln.ps\" in the\
 current directory.\n\n"
flag
off

option  "aln-EPS-cols"        -
"Number of columns in colored EPS alignment output.\n"
details="A value less than 1 indicates that the output should not be wrapped at all.\n\n"
int
default="60"
optional
hidden

option  "aln-stk"             -
"Create a multi-Stockholm formatted output file.\n"
details="The default file name used for the output is \"RNAalifold_results.stk\". Users may\
 change the filename to \"prefix.stk\" by specifying the prefix as optional argument. The file\
 will be create in the current directory if it does not already exist. In case the file already\
 exists, output will be appended to it.\
 Note: Any special characters in the filename will be replaced by the filename delimiter,\
 hence there is no way to pass an entire directory path through this option yet.\
 (See also the \"--filename-delim\" parameter)\n\n"
string
argoptional
typestr="prefix"
default="RNAalifold_results"
optional

option  "noPS"  -
"Do not produce postscript drawing of the mfe structure.\n\n"
flag
off

option  "noDP"  -
"Do not produce dot-plot postscript file containing base pair or stack probabilitities.\n"
details="In combination with the -p option, this flag turns-off creation of individual\
 dot-plot files. Consequently, computed base pair probability output is omitted but centroid\
 and MEA structure prediction is still performed.\n\n"
flag
dependon="partfunc"
off

option  "layout-type"  t
"Choose the layout algorithm.\n"
details="Select the layout algorithm that computes the nucleotide coordinates.\
 Currently, the following algorithms are available:\n\
 '0': simple radial layout\n\n\
 '1': Naview layout (Bruccoleri et al. 1988)\n\n\
 '2': circular layout\n\n\
 '3': RNAturtle (Wiegreffe et al. 2018)\n\n\
 '4': RNApuzzler (Wiegreffe et al. 2018)\n\n"
int
default="1"
optional
hidden


text  "Caveats:\n\nSequences are not weighted. If possible, do not mix very similar and\
 dissimilar sequences. Duplicate sequences, for example, can distort the prediction.\n\n"


text    "\nIf in doubt our program is right, nature is at fault.\nComments should be sent to\
 rna@tbi.univie.ac.at.\n\n"
