1 #ifndef VIENNA_RNA_PACKAGE_MODEL_H 2 #define VIENNA_RNA_PACKAGE_MODEL_H 3 4 /** 5 * @file model.h 6 * @ingroup model_details 7 * @brief The model details data structure and its corresponding modifiers 8 */ 9 10 /** 11 * @addtogroup model_details 12 * @{ 13 * @brief Functions and data structures to fine-tune the implemented 14 * secondary structure evaluation model. 15 */ 16 17 #ifndef NBASES 18 #define NBASES 8 19 #endif 20 21 /** @brief Typename for the model details data structure #vrna_md_s */ 22 typedef struct vrna_md_s vrna_md_t; 23 24 /** 25 * @brief 26 * @htmlonly Default temperature for structure prediction and free energy evaluation in °C @endhtmlonly 27 * @latexonly Default temperature for structure prediction and free energy evaluation in $^\circ C$ @endlatexonly 28 * @see #vrna_md_t.temperature, vrna_md_defaults_reset(), vrna_md_set_default() 29 */ 30 #define VRNA_MODEL_DEFAULT_TEMPERATURE 37.0 31 32 /** 33 * @brief Default scaling factor for partition function computations 34 * @see #vrna_exp_param_t.pf_scale, vrna_md_defaults_reset(), vrna_md_set_default() 35 */ 36 #define VRNA_MODEL_DEFAULT_PF_SCALE -1 37 38 /** 39 * @brief Default scaling factor for absolute thermodynamic temperature in Boltzmann factors 40 * @see #vrna_exp_param_t.alpha, #vrna_md_t.betaScale, vrna_md_defaults_reset(), vrna_md_set_default() 41 */ 42 #define VRNA_MODEL_DEFAULT_BETA_SCALE 1. 43 44 /** @brief Default dangling end model 45 * @see #vrna_md_t.dangles, vrna_md_defaults_reset(), vrna_md_set_default() 46 */ 47 #define VRNA_MODEL_DEFAULT_DANGLES 2 48 49 /** 50 * @brief Default model behavior for lookup of special tri-, tetra-, and hexa-loops 51 * @see #vrna_md_t.special_hp, vrna_md_defaults_reset(), vrna_md_set_default() 52 */ 53 #define VRNA_MODEL_DEFAULT_SPECIAL_HP 1 54 55 /** 56 * @brief Default model behavior for so-called 'lonely pairs' 57 * @see #vrna_md_t.noLP, vrna_md_defaults_reset(), vrna_md_set_default() 58 */ 59 #define VRNA_MODEL_DEFAULT_NO_LP 0 60 61 /** 62 * @brief Default model behavior for G-U base pairs 63 * @see #vrna_md_t.noGU, vrna_md_defaults_reset(), vrna_md_set_default() 64 */ 65 #define VRNA_MODEL_DEFAULT_NO_GU 0 66 67 /** 68 * @brief Default model behavior for G-U base pairs closing a loop 69 * @see #vrna_md_t.noGUclosure, vrna_md_defaults_reset(), vrna_md_set_default() 70 */ 71 #define VRNA_MODEL_DEFAULT_NO_GU_CLOSURE 0 72 73 /** 74 * @brief Default model behavior to treat a molecule as a circular RNA (DNA) 75 * @see #vrna_md_t.circ, vrna_md_defaults_reset(), vrna_md_set_default() 76 */ 77 #define VRNA_MODEL_DEFAULT_CIRC 0 78 79 /** 80 * @brief Default model behavior regarding the treatment of G-Quadruplexes 81 * @see #vrna_md_t.gquad, vrna_md_defaults_reset(), vrna_md_set_default() 82 */ 83 #define VRNA_MODEL_DEFAULT_GQUAD 0 84 85 /** 86 * @brief Default behavior of the model regarding unique multi-branch loop decomposition 87 * @see #vrna_md_t.uniq_ML, vrna_md_defaults_reset(), vrna_md_set_default() 88 */ 89 #define VRNA_MODEL_DEFAULT_UNIQ_ML 0 90 91 /** 92 * @brief Default model behavior on which energy set to use 93 * @see #vrna_md_t.energy_set, vrna_md_defaults_reset(), vrna_md_set_default() 94 */ 95 #define VRNA_MODEL_DEFAULT_ENERGY_SET 0 96 97 /** 98 * @brief Default model behavior with regards to backtracking of structures 99 * @see #vrna_md_t.backtrack, vrna_md_defaults_reset(), vrna_md_set_default() 100 */ 101 #define VRNA_MODEL_DEFAULT_BACKTRACK 1 102 103 /** 104 * @brief Default model behavior on what type of backtracking to perform 105 * @see #vrna_md_t.backtrack_type, vrna_md_defaults_reset(), vrna_md_set_default() 106 */ 107 #define VRNA_MODEL_DEFAULT_BACKTRACK_TYPE 'F' 108 109 /** 110 * @brief Default model behavior with regards to computing base pair probabilities 111 * @see #vrna_md_t.compute_bpp, vrna_md_defaults_reset(), vrna_md_set_default() 112 */ 113 #define VRNA_MODEL_DEFAULT_COMPUTE_BPP 1 114 115 /** 116 * @brief Default model behavior for the allowed maximum base pair span 117 * @see #vrna_md_t.max_bp_span, vrna_md_defaults_reset(), vrna_md_set_default() 118 */ 119 #define VRNA_MODEL_DEFAULT_MAX_BP_SPAN -1 120 121 /** 122 * @brief Default model behavior for the sliding window approach 123 * @see #vrna_md_t.window_size, vrna_md_defaults_reset(), vrna_md_set_default() 124 */ 125 #define VRNA_MODEL_DEFAULT_WINDOW_SIZE -1 126 127 /** 128 * @brief Default model behavior on how to evaluate the energy contribution of multi-branch loops 129 * @see #vrna_md_t.logML, vrna_md_defaults_reset(), vrna_md_set_default() 130 */ 131 #define VRNA_MODEL_DEFAULT_LOG_ML 0 132 133 /** 134 * @brief Default model behavior for consensus structure energy evaluation 135 * @see #vrna_md_t.oldAliEn, vrna_md_defaults_reset(), vrna_md_set_default() 136 */ 137 #define VRNA_MODEL_DEFAULT_ALI_OLD_EN 0 138 139 /** 140 * @brief Default model behavior for consensus structure co-variance contribution assessment 141 * @see #vrna_md_t.ribo, vrna_md_defaults_reset(), vrna_md_set_default() 142 */ 143 #define VRNA_MODEL_DEFAULT_ALI_RIBO 0 144 145 /** 146 * @brief Default model behavior for weighting the co-variance score in consensus structure prediction 147 * @see #vrna_md_t.cv_fact, vrna_md_defaults_reset(), vrna_md_set_default() 148 */ 149 #define VRNA_MODEL_DEFAULT_ALI_CV_FACT 1. 150 151 /** @brief Default model behavior for weighting the nucleotide conservation? in consensus structure prediction 152 * @see #vrna_md_t.nc_fact, vrna_md_defaults_reset(), vrna_md_set_default() 153 */ 154 #define VRNA_MODEL_DEFAULT_ALI_NC_FACT 1. 155 156 157 #define VRNA_MODEL_DEFAULT_PF_SMOOTH 1 158 159 160 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY 161 162 #ifndef MAXALPHA 163 /** 164 * @brief Maximal length of alphabet 165 */ 166 #define MAXALPHA 20 167 #endif 168 169 #endif 170 171 /** 172 * @brief The data structure that contains the complete model details used throughout the calculations 173 * 174 * For convenience reasons, we provide the type name #vrna_md_t to address this data structure 175 * without the use of the struct keyword 176 * 177 * @see vrna_md_set_default(), set_model_details(), vrna_md_update(), #vrna_md_t 178 * 179 */ 180 struct vrna_md_s { 181 double temperature; /**< @brief The temperature used to scale the thermodynamic parameters */ 182 double betaScale; /**< @brief A scaling factor for the thermodynamic temperature of the Boltzmann factors */ 183 int pf_smooth; /**< @brief A flat specifying whether energies in Boltzmann factors need to be smoothed */ 184 int dangles; /**< @brief Specifies the dangle model used in any energy evaluation (0,1,2 or 3) 185 * 186 * If set to 0 no stabilizing energies are assigned to bases adjacent to 187 * helices in free ends and multiloops (so called dangling ends). Normally 188 * (dangles = 1) dangling end energies are assigned only to unpaired 189 * bases and a base cannot participate simultaneously in two dangling ends. In 190 * the partition function algorithm vrna_pf() these checks are neglected. 191 * To provide comparability between free energy minimization and partition function 192 * algorithms, the default setting is 2. 193 * This treatment of dangling ends gives more favorable energies to helices 194 * directly adjacent to one another, which can be beneficial since such 195 * helices often do engage in stabilizing interactions through co-axial 196 * stacking.\n 197 * If set to 3 co-axial stacking is explicitly included for 198 * adjacent helices in multiloops. The option affects only mfe folding 199 * and energy evaluation (vrna_mfe() and vrna_eval_structure()), as 200 * well as suboptimal folding (vrna_subopt()) via re-evaluation of energies. 201 * Co-axial stacking with one intervening mismatch is not considered so far. 202 * @note Some function do not implement all dangle model but only a subset of 203 * (0,1,2,3). In particular, partition function algorithms can only handle 204 * 0 and 2. Read the documentation of the particular recurrences or 205 * energy evaluation function for information about the provided dangle 206 * model. 207 */ 208 int special_hp; /**< @brief Include special hairpin contributions for tri, tetra and hexaloops */ 209 int noLP; /**< @brief Only consider canonical structures, i.e. no 'lonely' base pairs */ 210 int noGU; /**< @brief Do not allow GU pairs */ 211 int noGUclosure; /**< @brief Do not allow loops to be closed by GU pair */ 212 int logML; /**< @brief Use logarithmic scaling for multiloops */ 213 int circ; /**< @brief Assume RNA to be circular instead of linear */ 214 int gquad; /**< @brief Include G-quadruplexes in structure prediction */ 215 int uniq_ML; /**< @brief Flag to ensure unique multi-branch loop decomposition during folding */ 216 int energy_set; /**< @brief Specifies the energy set that defines set of compatible base pairs */ 217 int backtrack; /**< @brief Specifies whether or not secondary structures should be backtraced */ 218 char backtrack_type; /**< @brief Specifies in which matrix to backtrack */ 219 int compute_bpp; /**< @brief Specifies whether or not backward recursions for base pair probability (bpp) computation will be performed */ 220 char nonstandards[64]; /**< @brief contains allowed non standard bases */ 221 int max_bp_span; /**< @brief maximum allowed base pair span */ 222 223 int min_loop_size; /**< @brief Minimum size of hairpin loops 224 * @note The default value for this field is #TURN, however, it may 225 * be 0 in cofolding context. 226 */ 227 int window_size; /**< @brief Size of the sliding window for locally optimal structure prediction */ 228 int oldAliEn; /**< @brief Use old alifold energy model */ 229 int ribo; /**< @brief Use ribosum scoring table in alifold energy model */ 230 double cv_fact; /**< @brief Co-variance scaling factor for consensus structure prediction */ 231 double nc_fact; /**< @brief Scaling factor to weight co-variance contributions of non-canonical pairs */ 232 double sfact; /**< @brief Scaling factor for partition function scaling */ 233 int rtype[8]; /**< @brief Reverse base pair type array */ 234 short alias[MAXALPHA + 1]; /**< @brief alias of an integer nucleotide representation */ 235 int pair[MAXALPHA + 1][MAXALPHA + 1]; /**< @brief Integer representation of a base pair */ 236 }; 237 238 239 /** 240 * @brief Apply default model details to a provided #vrna_md_t data structure 241 * 242 * Use this function to initialize a #vrna_md_t data structure with 243 * its default values 244 * 245 * @param md A pointer to the data structure that is about to be initialized 246 */ 247 void 248 vrna_md_set_default(vrna_md_t *md); 249 250 251 /** 252 * @brief Update the model details data structure 253 * 254 * This function should be called after changing the vrna_md_t.energy_set attribute 255 * since it re-initializes base pairing related arrays within the #vrna_md_t data 256 * structure. In particular, #vrna_md_t.pair, #vrna_md_t.alias, and #vrna_md_t.rtype 257 * are set to the values that correspond to the specified #vrna_md_t.energy_set 258 * option 259 * 260 * @see #vrna_md_t, #vrna_md_t.energy_set, #vrna_md_t.pair, #vrna_md_t.rtype, 261 * #vrna_md_t.alias, vrna_md_set_default() 262 */ 263 void 264 vrna_md_update(vrna_md_t *md); 265 266 267 /** 268 * @brief Copy/Clone a #vrna_md_t model 269 * 270 * Use this function to clone a given model either inplace (target container @p md_to 271 * given) or create a copy by cloning the source model and returning it (@p md_to == NULL). 272 * 273 * @param md_to The model to be overwritten (if non-NULL and @p md_to != @p md_from) 274 * @param md_from The model to copy (if non-NULL) 275 * @return A pointer to the copy model (or NULL if @p md_from == NULL) 276 */ 277 vrna_md_t * 278 vrna_md_copy(vrna_md_t *md_to, 279 const vrna_md_t *md_from); 280 281 282 /** 283 * @brief Get a corresponding commandline parameter string of the options in a #vrna_md_t 284 * 285 * @note This function is not threadsafe! 286 */ 287 char * 288 vrna_md_option_string(vrna_md_t *md); 289 290 291 void 292 vrna_md_set_nonstandards(vrna_md_t *md, 293 const char *ns_bases); 294 295 296 /** 297 * @brief Reset the global default model details to a specific set of parameters, or their initial values 298 * 299 * This function resets the global default model details to their initial values, 300 * i.e. as specified by the ViennaRNA Package release, upon passing NULL as argument. 301 * Alternatively it resets them according to a set of provided parameters. 302 * 303 * @note The global default parameters affect all function calls of RNAlib where 304 * model details are not explicitly provided. Hence, any change of them 305 * is not considered threadsafe 306 * @warning This function first resets the global default settings to factory 307 * defaults, and only then applies user provided settings (if any). 308 * User settings that do not meet specifications are skipped. 309 * @see vrna_md_set_default(), #vrna_md_t 310 * 311 * @param md_p A set of model details to use as global default (if NULL is passed, factory defaults are restored) 312 */ 313 void 314 vrna_md_defaults_reset(vrna_md_t *md_p); 315 316 317 /** 318 * @brief Set default temperature for energy evaluation of loops 319 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_TEMPERATURE 320 * @param T Temperature in centigrade 321 */ 322 void 323 vrna_md_defaults_temperature(double T); 324 325 326 /** 327 * @brief Get default temperature for energy evaluation of loops 328 * @see vrna_md_defaults_temperature(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_TEMPERATURE 329 * @return The global default settings for temperature in centigrade 330 */ 331 double 332 vrna_md_defaults_temperature_get(void); 333 334 335 /** 336 * @brief Set default scaling factor of thermodynamic temperature in Boltzmann factors 337 * 338 * Bolzmann factors are then computed as @f$ exp(-E / (b \cdot kT))@f$. 339 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BETA_SCALE 340 * @param b The scaling factor, default is 1.0 341 */ 342 void 343 vrna_md_defaults_betaScale(double b); 344 345 346 /** 347 * @brief Get default scaling factor of thermodynamic temperature in Boltzmann factors 348 * 349 * @see vrna_md_defaults_betaScale(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BETA_SCALE 350 * @return The global default thermodynamic temperature scaling factor 351 */ 352 double 353 vrna_md_defaults_betaScale_get(void); 354 355 356 void 357 vrna_md_defaults_pf_smooth(int s); 358 359 360 int 361 vrna_md_defaults_pf_smooth_get(void); 362 363 364 /** 365 * @brief Set default dangle model for structure prediction 366 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_DANGLES 367 * @param d The dangle model 368 */ 369 void 370 vrna_md_defaults_dangles(int d); 371 372 373 /** 374 * @brief Get default dangle model for structure prediction 375 * @see vrna_md_defaults_dangles(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_DANGLES 376 * @return The global default settings for the dangle model 377 */ 378 int 379 vrna_md_defaults_dangles_get(void); 380 381 382 /** 383 * @brief Set default behavior for lookup of tabulated free energies for special hairpin loops, such as Tri-, Tetra-, or Hexa-loops. 384 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_SPECIAL_HP 385 * @param flag On/Off switch (0 = OFF, else = ON) 386 */ 387 void 388 vrna_md_defaults_special_hp(int flag); 389 390 391 /** 392 * @brief Get default behavior for lookup of tabulated free energies for special hairpin loops, such as Tri-, Tetra-, or Hexa-loops. 393 * @see vrna_md_defaults_special_hp(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_SPECIAL_HP 394 * @return The global default settings for the treatment of special hairpin loops 395 */ 396 int 397 vrna_md_defaults_special_hp_get(void); 398 399 400 /** 401 * @brief Set default behavior for prediction of canonical secondary structures 402 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_LP 403 * @param flag On/Off switch (0 = OFF, else = ON) 404 */ 405 void 406 vrna_md_defaults_noLP(int flag); 407 408 409 /** 410 * @brief Get default behavior for prediction of canonical secondary structures 411 * @see vrna_md_defaults_noLP(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_LP 412 * @return The global default settings for predicting canonical secondary structures 413 */ 414 int 415 vrna_md_defaults_noLP_get(void); 416 417 418 /** 419 * @brief Set default behavior for treatment of G-U wobble pairs 420 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU 421 * @param flag On/Off switch (0 = OFF, else = ON) 422 */ 423 void 424 vrna_md_defaults_noGU(int flag); 425 426 427 /** 428 * @brief Get default behavior for treatment of G-U wobble pairs 429 * @see vrna_md_defaults_noGU(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU 430 * @return The global default settings for treatment of G-U wobble pairs 431 */ 432 int 433 vrna_md_defaults_noGU_get(void); 434 435 436 /** 437 * @brief Set default behavior for G-U pairs as closing pair for loops 438 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU_CLOSURE 439 * @param flag On/Off switch (0 = OFF, else = ON) 440 */ 441 void 442 vrna_md_defaults_noGUclosure(int flag); 443 444 445 /** 446 * @brief Get default behavior for G-U pairs as closing pair for loops 447 * @see vrna_md_defaults_noGUclosure(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU_CLOSURE 448 * @return The global default settings for treatment of G-U pairs closing a loop 449 */ 450 int 451 vrna_md_defaults_noGUclosure_get(void); 452 453 454 /** 455 * @brief Set default behavior recomputing free energies of multi-branch loops using a logarithmic model 456 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_LOG_ML 457 * @param flag On/Off switch (0 = OFF, else = ON) 458 */ 459 void 460 vrna_md_defaults_logML(int flag); 461 462 463 /** 464 * @brief Get default behavior recomputing free energies of multi-branch loops using a logarithmic model 465 * @see vrna_md_defaults_logML(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_LOG_ML 466 * @return The global default settings for logarithmic model in multi-branch loop free energy evaluation 467 */ 468 int 469 vrna_md_defaults_logML_get(void); 470 471 472 /** 473 * @brief Set default behavior whether input sequences are circularized 474 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_CIRC 475 * @param flag On/Off switch (0 = OFF, else = ON) 476 */ 477 void 478 vrna_md_defaults_circ(int flag); 479 480 481 /** 482 * @brief Get default behavior whether input sequences are circularized 483 * @see vrna_md_defaults_circ(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_CIRC 484 * @return The global default settings for treating input sequences as circular 485 */ 486 int 487 vrna_md_defaults_circ_get(void); 488 489 490 /** 491 * @brief Set default behavior for treatment of G-Quadruplexes 492 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_GQUAD 493 * @param flag On/Off switch (0 = OFF, else = ON) 494 */ 495 void 496 vrna_md_defaults_gquad(int flag); 497 498 499 /** 500 * @brief Get default behavior for treatment of G-Quadruplexes 501 * @see vrna_md_defaults_gquad(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_GQUAD 502 * @return The global default settings for treatment of G-Quadruplexes 503 */ 504 int 505 vrna_md_defaults_gquad_get(void); 506 507 508 /** 509 * @brief Set default behavior for creating additional matrix for unique multi-branch loop prediction 510 * @note Activating this option usually results in higher memory consumption! 511 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_UNIQ_ML 512 * @param flag On/Off switch (0 = OFF, else = ON) 513 */ 514 void 515 vrna_md_defaults_uniq_ML(int flag); 516 517 518 /** 519 * @brief Get default behavior for creating additional matrix for unique multi-branch loop prediction 520 * @see vrna_md_defaults_uniq_ML(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_UNIQ_ML 521 * @return The global default settings for creating additional matrices for unique multi-branch loop prediction 522 */ 523 int 524 vrna_md_defaults_uniq_ML_get(void); 525 526 527 /** 528 * @brief Set default energy set 529 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ENERGY_SET 530 * @param e Energy set (0, 1, 2, 3) 531 */ 532 void 533 vrna_md_defaults_energy_set(int e); 534 535 536 /** 537 * @brief Get default energy set 538 * @see vrna_md_defaults_energy_set(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ENERGY_SET 539 * @return The global default settings for the energy set 540 */ 541 int 542 vrna_md_defaults_energy_set_get(void); 543 544 545 /** 546 * @brief Set default behavior for whether to backtrack secondary structures 547 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK 548 * @param flag On/Off switch (0 = OFF, else = ON) 549 */ 550 void 551 vrna_md_defaults_backtrack(int flag); 552 553 554 /** 555 * @brief Get default behavior for whether to backtrack secondary structures 556 * @see vrna_md_defaults_backtrack(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK 557 * @return The global default settings for backtracking structures 558 */ 559 int 560 vrna_md_defaults_backtrack_get(void); 561 562 563 /** 564 * @brief Set default backtrack type, i.e. which DP matrix is used 565 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK_TYPE 566 * @param t The type ('F', 'C', or 'M') 567 */ 568 void 569 vrna_md_defaults_backtrack_type(char t); 570 571 572 /** 573 * @brief Get default backtrack type, i.e. which DP matrix is used 574 * @see vrna_md_defaults_backtrack_type(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK_TYPE 575 * @return The global default settings that specify which DP matrix is used for backtracking 576 */ 577 char 578 vrna_md_defaults_backtrack_type_get(void); 579 580 581 /** 582 * @brief Set the default behavior for whether to compute base pair probabilities after partition function computation 583 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_COMPUTE_BPP 584 * @param flag On/Off switch (0 = OFF, else = ON) 585 */ 586 void 587 vrna_md_defaults_compute_bpp(int flag); 588 589 590 /** 591 * @brief Get the default behavior for whether to compute base pair probabilities after partition function computation 592 * @see vrna_md_defaults_compute_bpp(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_COMPUTE_BPP 593 * @return The global default settings that specify whether base pair probabilities are computed together with partition function 594 */ 595 int 596 vrna_md_defaults_compute_bpp_get(void); 597 598 599 /** 600 * @brief Set default maximal base pair span 601 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_MAX_BP_SPAN 602 * @param span Maximal base pair span 603 */ 604 void 605 vrna_md_defaults_max_bp_span(int span); 606 607 608 /** 609 * @brief Get default maximal base pair span 610 * @see vrna_md_defaults_max_bp_span(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_MAX_BP_SPAN 611 * @return The global default settings for maximum base pair span 612 */ 613 int 614 vrna_md_defaults_max_bp_span_get(void); 615 616 617 /** 618 * @brief Set default minimal loop size 619 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #TURN 620 * @param size Minimal size, i.e. number of unpaired nucleotides for a hairpin loop 621 */ 622 void 623 vrna_md_defaults_min_loop_size(int size); 624 625 626 /** 627 * @brief Get default minimal loop size 628 * @see vrna_md_defaults_min_loop_size(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #TURN 629 * @return The global default settings for minimal size of hairpin loops 630 */ 631 int 632 vrna_md_defaults_min_loop_size_get(void); 633 634 635 /** 636 * @brief Set default window size for sliding window structure prediction approaches 637 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_WINDOW_SIZE 638 * @param size The size of the sliding window 639 */ 640 void 641 vrna_md_defaults_window_size(int size); 642 643 644 /** 645 * @brief Get default window size for sliding window structure prediction approaches 646 * @see vrna_md_defaults_window_size(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_WINDOW_SIZE 647 * @return The global default settings for the size of the sliding window 648 */ 649 int 650 vrna_md_defaults_window_size_get(void); 651 652 653 /** 654 * @brief Set default behavior for whether to use old energy model for comparative structure prediction 655 * @note This option is outdated. Activating the old energy model usually results in worse consensus 656 * structure predictions. 657 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_OLD_EN 658 * @param flag On/Off switch (0 = OFF, else = ON) 659 */ 660 void 661 vrna_md_defaults_oldAliEn(int flag); 662 663 664 /** 665 * @brief Get default behavior for whether to use old energy model for comparative structure prediction 666 * @see vrna_md_defaults_oldAliEn(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_OLD_EN 667 * @return The global default settings for using old energy model for comparative structure prediction 668 */ 669 int 670 vrna_md_defaults_oldAliEn_get(void); 671 672 673 /** 674 * @brief Set default behavior for whether to use Ribosum Scoring in comparative structure prediction 675 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_RIBO 676 * @param flag On/Off switch (0 = OFF, else = ON) 677 */ 678 void 679 vrna_md_defaults_ribo(int flag); 680 681 682 /** 683 * @brief Get default behavior for whether to use Ribosum Scoring in comparative structure prediction 684 * @see vrna_md_defaults_ribo(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_RIBO 685 * @return The global default settings for using Ribosum scoring in comparative structure prediction 686 */ 687 int 688 vrna_md_defaults_ribo_get(void); 689 690 691 /** 692 * @brief Set the default co-variance scaling factor used in comparative structure prediction 693 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_CV_FACT 694 * @param factor The co-variance factor 695 */ 696 void 697 vrna_md_defaults_cv_fact(double factor); 698 699 700 /** 701 * @brief Get the default co-variance scaling factor used in comparative structure prediction 702 * @see vrna_md_defaults_cv_fact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_CV_FACT 703 * @return The global default settings for the co-variance factor 704 */ 705 double 706 vrna_md_defaults_cv_fact_get(void); 707 708 709 /** 710 * @brief 711 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_NC_FACT 712 * @param factor 713 */ 714 void 715 vrna_md_defaults_nc_fact(double factor); 716 717 718 /** 719 * @brief 720 * @see vrna_md_defaults_nc_fact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_NC_FACT 721 * @return 722 */ 723 double 724 vrna_md_defaults_nc_fact_get(void); 725 726 727 /** 728 * @brief Set the default scaling factor used to avoid under-/overflows in partition function computation 729 * @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t 730 * @param factor The scaling factor (default: 1.07) 731 */ 732 void 733 vrna_md_defaults_sfact(double factor); 734 735 736 /** 737 * @brief Get the default scaling factor used to avoid under-/overflows in partition function computation 738 * @see vrna_md_defaults_sfact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t 739 * @return The global default settings of the scaling factor 740 */ 741 double 742 vrna_md_defaults_sfact_get(void); 743 744 745 #ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY 746 747 #define model_detailsT vrna_md_t /* restore compatibility of struct rename */ 748 749 /* BEGIN deprecated global variables: */ 750 751 /** 752 * @brief Rescale energy parameters to a temperature in degC. 753 * 754 * Default is 37C. You have to call the update_..._params() functions after 755 * changing this parameter. 756 * @deprecated Use vrna_md_defaults_temperature(), and vrna_md_defaults_temperature_get() 757 * to change, and read the global default temperature settings 758 * @see vrna_md_defaults_temperature(), vrna_md_defaults_temperature_get(), vrna_md_defaults_reset() 759 */ 760 extern double temperature; 761 762 /** 763 * @brief A scaling factor used by pf_fold() to avoid overflows. 764 * 765 * Should be set to approximately @f$exp{((-F/kT)/length)}@f$, where @f$F@f$ is an estimate 766 * for the ensemble free energy, for example the minimum free energy. You must 767 * call update_pf_params() after changing this parameter.\n 768 * If pf_scale is -1 (the default) , an estimate will be provided 769 * automatically when computing partition functions, e.g. pf_fold() 770 * The automatic estimate is usually insufficient for sequences more 771 * than a few hundred bases long. 772 */ 773 extern double pf_scale; 774 775 /** 776 * @brief Switch the energy model for dangling end contributions (0, 1, 2, 3) 777 * 778 * If set to 0 no stabilizing energies are assigned to bases adjacent to 779 * helices in free ends and multiloops (so called dangling ends). Normally 780 * (dangles = 1) dangling end energies are assigned only to unpaired 781 * bases and a base cannot participate simultaneously in two dangling ends. In 782 * the partition function algorithm pf_fold() these checks are neglected. 783 * If #dangles is set to 2, all folding routines will follow this convention. 784 * This treatment of dangling ends gives more favorable energies to helices 785 * directly adjacent to one another, which can be beneficial since such 786 * helices often do engage in stabilizing interactions through co-axial 787 * stacking.\n 788 * If dangles = 3 co-axial stacking is explicitly included for 789 * adjacent helices in multiloops. The option affects only mfe folding 790 * and energy evaluation (fold() and energy_of_structure()), as 791 * well as suboptimal folding (subopt()) via re-evaluation of energies. 792 * Co-axial stacking with one intervening mismatch is not considered so far. 793 * 794 * Default is 2 in most algorithms, partition function algorithms can only handle 0 and 2 795 */ 796 extern int dangles; 797 798 /** 799 * @brief Include special stabilizing energies for some tri-, tetra- and hexa-loops; 800 * 801 * default is 1. 802 */ 803 extern int tetra_loop; 804 805 /** 806 * @brief Global switch to avoid/allow helices of length 1 807 * 808 * Disallow all pairs which can only occur as lonely pairs (i.e. as helix 809 * of length 1). This avoids lonely base pairs in the predicted structures in 810 * most cases. 811 */ 812 extern int noLonelyPairs; 813 814 /** 815 * @brief Global switch to forbid/allow GU base pairs at all 816 */ 817 extern int noGU; 818 819 /** 820 * @brief GU allowed only inside stacks if set to 1 821 */ 822 extern int no_closingGU; 823 824 /** 825 * @brief backward compatibility variable.. this does not effect anything 826 */ 827 extern int circ; 828 829 /** 830 * @brief Allow G-quadruplex formation 831 */ 832 extern int gquad; 833 834 /** 835 * @brief do ML decomposition uniquely (for subopt) 836 */ 837 extern int uniq_ML; 838 839 /** 840 * @brief 0 = BP; 1=any with GC; 2=any with AU-parameter 841 * 842 * If set to 1 or 2: fold sequences from an artificial alphabet ABCD..., where A 843 * pairs B, C pairs D, etc. using either GC (1) or AU parameters (2); 844 * default is 0, you probably don't want to change it. 845 */ 846 extern int energy_set; 847 848 /** 849 * @brief do backtracking, i.e. compute secondary structures or base pair probabilities 850 * 851 * If 0, do not calculate pair probabilities in pf_fold(); this is about 852 * twice as fast. Default is 1. 853 */ 854 extern int do_backtrack; 855 856 /** 857 * @brief A backtrack array marker for inverse_fold() 858 * 859 * If set to 'C': force (1,N) to be paired, 860 * 'M' fold as if the sequence were inside a multiloop. Otherwise ('F') the 861 * usual mfe structure is computed. 862 */ 863 extern char backtrack_type; 864 865 /** 866 * @brief contains allowed non standard base pairs 867 * 868 * Lists additional base pairs that will be allowed to form in addition to 869 * GC, CG, AU, UA, GU and UG. Nonstandard base pairs are given a stacking 870 * energy of 0. 871 */ 872 extern char *nonstandards; 873 874 /** 875 * @brief Maximum allowed base pair span 876 * 877 * A value of -1 indicates no restriction for distant base pairs. 878 */ 879 extern int max_bp_span; 880 881 /** 882 * @brief use old alifold energies (with gaps) 883 */ 884 extern int oldAliEn; 885 886 /** 887 * @brief use ribosum matrices 888 */ 889 extern int ribo; 890 891 extern double cv_fact; 892 893 extern double nc_fact; 894 895 /** @brief if nonzero use logarithmic ML energy in energy_of_struct */ 896 extern int logML; 897 898 /* END deprecated global variables: */ 899 900 /** 901 * @brief Set default model details 902 * 903 * Use this function if you wish to initialize a #vrna_md_t data structure with 904 * its default values, i.e. the global model settings as provided by the deprecated 905 * global variables. 906 * 907 * @deprecated This function will vanish as soon as backward compatibility of 908 * RNAlib is dropped (expected in version 3). 909 * Use vrna_md_set_default() instead! 910 * 911 * @param md A pointer to the data structure that is about to be initialized 912 */ 913 void 914 set_model_details(vrna_md_t *md); 915 916 917 char * 918 option_string(void); 919 920 921 #endif 922 /** 923 * @} 924 */ 925 926 #endif 927