1#ifndef VIENNA_RNA_PACKAGE_LOOPS_INTERNAL_H
2#define VIENNA_RNA_PACKAGE_LOOPS_INTERNAL_H
7#include <ViennaRNA/params/default.h>
15#ifdef VRNA_WARN_DEPRECATED
16# if defined(DEPRECATED)
19# if defined(__clang__)
20# define DEPRECATED(func, msg) func __attribute__ ((deprecated("", msg)))
21# elif defined(__GNUC__)
22# define DEPRECATED(func, msg) func __attribute__ ((deprecated(msg)))
24# define DEPRECATED(func, msg) func
27# define DEPRECATED(func, msg) func
158#ifndef VRNA_DISABLE_BACKWARD_COMPATIBILITY
169#define ON_SAME_STRAND(I, J, C) (((I) >= (C)) || ((J) < (C)))
257PRIVATE INLINE
int E_IntLoop_Co(
int type,
283ubf_eval_int_loop(
int i,
296 unsigned char type_2,
308 if ((cp < 0) || (ON_SAME_STRAND(i, p, cp) && ON_SAME_STRAND(q, j, cp))) {
310 energy =
E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
314 Si = ON_SAME_STRAND(i, i1, cp) ? si : -1;
315 Sj = ON_SAME_STRAND(j1, j, cp) ? sj : -1;
316 energy = E_IntLoop_Co(rtype[type], rtype[type_2],
352ubf_eval_int_loop2(
int i,
365 unsigned char type_2,
378 if ((sn[i] == sn[p]) && (sn[q] == sn[j])) {
380 energy =
E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
384 Si = (sn[i1] == sn[i]) ? si : -1;
385 Sj = (sn[j] == sn[j1]) ? sj : -1;
386 energy = E_IntLoop_Co(rtype[type], rtype[type_2],
432ubf_eval_ext_int_loop(
int i,
445 unsigned char type_2,
450 int energy, u1, u2, u3;
456 energy =
E_IntLoop(u2, u1 + u3, type, type_2, si, sj, sp, sq, P);
463 + ((u1 > 0) ? sc->energy_up[1][u1] : 0);
467 if (u1 + u2 + u3 == 0)
493 int nl, ns, u, energy, salt_stack_correction, salt_loop_correction, backbones;
495 salt_stack_correction = P->SaltStack;
496 salt_loop_correction = 0;
507 return P->stack[type][type_2] + salt_stack_correction;
515 salt_loop_correction = P->SaltLoop[backbones];
522 energy = (nl <=
MAXLOOP) ? P->bulge[nl] :
523 (P->bulge[30] + (int)(P->lxc * log(nl / 30.)));
525 energy += P->stack[type][type_2];
528 energy += P->TerminalAU;
531 energy += P->TerminalAU;
534 return energy + salt_loop_correction;
539 return P->int11[type][type_2][si1][sj1] + salt_loop_correction;
544 energy = P->int21[type][type_2][si1][sq1][sj1];
546 energy = P->int21[type_2][type][sq1][si1][sp1];
548 return energy + salt_loop_correction;
553 MAXLOOP) ? (P->internal_loop[nl + 1]) : (P->internal_loop[30] +
554 (int)(P->lxc * log((nl + 1) / 30.)));
555 energy +=
MIN2(MAX_NINIO, (nl - ns) * P->ninio[2]);
556 energy += P->mismatch1nI[type][si1][sj1] + P->mismatch1nI[type_2][sq1][sp1];
557 return energy + salt_loop_correction;
559 }
else if (ns == 2) {
562 return P->int22[type][type_2][si1][sp1][sq1][sj1] + salt_loop_correction;
563 }
else if (nl == 3) {
565 energy = P->internal_loop[5] + P->ninio[2];
566 energy += P->mismatch23I[type][si1][sj1] + P->mismatch23I[type_2][sq1][sp1];
567 return energy + salt_loop_correction;
576 MAXLOOP) ? (P->internal_loop[u]) : (P->internal_loop[30] + (int)(P->lxc * log((u) / 30.)));
578 energy +=
MIN2(MAX_NINIO, (nl - ns) * P->ninio[2]);
580 energy += P->mismatchI[type][si1][sj1] + P->mismatchI[type_2][sq1][sp1];
584 return energy + salt_loop_correction;
599 int ul, us, no_close = 0;
603 double salt_stack_correction = P->expSaltStack;
604 double salt_loop_correction = 1.;
606 if ((noGUclosure) && ((type2 == 3) || (type2 == 4) || (type == 3) || (type == 4)))
622 salt_loop_correction = P->expSaltLoop[backbones];
629 z = P->expstack[type][type2] * salt_stack_correction;
630 }
else if (!no_close) {
635 z *= P->expstack[type][type2];
644 return (
FLT_OR_DBL)(z * salt_loop_correction);
645 }
else if (us == 1) {
647 return (
FLT_OR_DBL)(P->expint11[type][type2][si1][sj1] * salt_loop_correction);
652 return (
FLT_OR_DBL)(P->expint21[type][type2][si1][sq1][sj1] * salt_loop_correction);
654 return (
FLT_OR_DBL)(P->expint21[type2][type][sq1][si1][sp1] * salt_loop_correction);
657 z = P->expinternal[ul + us] * P->expmismatch1nI[type][si1][sj1] *
658 P->expmismatch1nI[type2][sq1][sp1];
659 return (
FLT_OR_DBL)(z * P->expninio[2][ul - us] * salt_loop_correction);
661 }
else if (us == 2) {
664 return (
FLT_OR_DBL)(P->expint22[type][type2][si1][sp1][sq1][sj1] * salt_loop_correction);
665 }
else if (ul == 3) {
667 z = P->expinternal[5] * P->expmismatch23I[type][si1][sj1] *
668 P->expmismatch23I[type2][sq1][sp1];
669 return (
FLT_OR_DBL)(z * P->expninio[2][1] * salt_loop_correction);
674 z = P->expinternal[ul + us] * P->expmismatchI[type][si1][sj1] *
675 P->expmismatchI[type2][sq1][sp1];
676 return (
FLT_OR_DBL)(z * P->expninio[2][ul - us] * salt_loop_correction);
684E_IntLoop_Co(
int type,
698 int e, energy, ci, cj, cp, cq, d3, d5, d5_2, d3_2, tmm, tmm_2;
699 int salt_loop_correction, backbones;
701 salt_loop_correction = 0;
703 backbones = p - i + j - q;
707 salt_loop_correction = P->SaltLoop[backbones];
714 energy += P->TerminalAU;
717 energy += P->TerminalAU;
720 return energy + salt_loop_correction;
722 ci = ON_SAME_STRAND(i, i + 1, cutpoint);
723 cj = ON_SAME_STRAND(j - 1, j, cutpoint);
724 cp = ON_SAME_STRAND(p - 1, p, cutpoint);
725 cq = ON_SAME_STRAND(q, q + 1, cutpoint);
727 d3 = ci ? P->dangle3[type][si1] : 0;
728 d5 = cj ? P->dangle5[type][sj1] : 0;
729 d5_2 = cp ? P->dangle5[type_2][sp1] : 0;
730 d3_2 = cq ? P->dangle3[type_2][sq1] : 0;
732 tmm = (cj && ci) ? P->mismatchExt[type][sj1][si1] : d5 + d3;
733 tmm_2 = (cp && cq) ? P->mismatchExt[type_2][sp1][sq1] : d5_2 + d3_2;
736 return energy + tmm + tmm_2 + salt_loop_correction;
745 e =
MIN2(tmm_2, d5_2);
748 }
else if (j - q == 2) {
750 e =
MIN2(tmm + d5_2, d3 + d5_2);
751 e =
MIN2(e, d5 + d5_2);
752 e =
MIN2(e, d3 + tmm_2);
753 e =
MIN2(e, d3 + d3_2);
762 }
else if (p - i == 2) {
765 e =
MIN2(tmm + d3_2, d5 + d3_2);
766 e =
MIN2(e, d5 + d3_2);
767 e =
MIN2(e, d3 + d3_2);
768 e =
MIN2(e, d5 + tmm_2);
773 }
else if (j - q == 2) {
775 e =
MIN2(tmm, tmm_2);
780 e =
MIN2(e, d3 + d3_2);
781 e =
MIN2(e, d5 + d5_2);
785 energy +=
MIN2(d3, d5_2);
792 }
else if (j - q == 2) {
794 energy +=
MIN2(d5, d3_2);
798 return energy + salt_loop_correction;
#define MAXLOOP
Definition constants.h:29
Various data structures and pre-processor macros.
The Basic Fold Compound API.
#define VRNA_DECOMP_PAIR_IL
Indicator for interior loop decomposition step.
Definition basic.h:148
double FLT_OR_DBL
Typename for floating point number in partition function computations.
Definition basic.h:43
Base pair stack element.
Definition basic.h:143
double temperature
Temperature used for loop contribution scaling.
Definition basic.h:153
vrna_md_t model_details
Model details to be used in the recursions.
Definition basic.h:96
vrna_md_t model_details
Model details to be used in the recursions.
Definition basic.h:161
double temperature
Temperature used for loop contribution scaling.
Definition basic.h:94
int vrna_salt_loop_int(int L, double salt, double T, double backbonelen)
Get salt correction for a loop at a given salt concentration and temperature.
The data structure that contains temperature scaled Boltzmann weights of the energy parameters.
Definition basic.h:110
The datastructure that contains temperature scaled energy parameters.
Definition basic.h:57
PRIVATE FLT_OR_DBL exp_E_IntLoop(int u1, int u2, int type, int type2, short si1, short sj1, short sp1, short sq1, vrna_exp_param_t *P)
Definition internal.h:589
PRIVATE int E_IntLoop(int n1, int n2, int type, int type_2, int si1, int sj1, int sp1, int sq1, vrna_param_t *P)
Definition internal.h:482
int vrna_eval_int_loop(vrna_fold_compound_t *fc, int i, int j, int k, int l)
Evaluate the free energy contribution of an interior loop with delimiting base pairs and .
The most basic data structure required by many functions throughout the RNAlib.
Definition fold_compound.h:161
int vrna_BT_stack(vrna_fold_compound_t *fc, int *i, int *j, int *en, vrna_bp_stack_t *bp_stack, int *stack_count)
Backtrack a stacked pair closed by .
int vrna_BT_int_loop(vrna_fold_compound_t *fc, int *i, int *j, int en, vrna_bp_stack_t *bp_stack, int *stack_count)
Backtrack an interior loop closed by .
float backbone_length
Definition model.h:312
double salt
Salt (monovalent) concentration (M) in buffer.
Definition model.h:303
int noGUclosure
Do not allow loops to be closed by GU pair.
Definition model.h:276
int dangles
Specifies the dangle model used in any energy evaluation (0,1,2 or 3)
Definition model.h:249
int dangles
Switch the energy model for dangling end contributions (0, 1, 2, 3)
#define VRNA_MODEL_DEFAULT_SALT
Default model salt concentration (M)
Definition model.h:182
vrna_sc_f f
A function pointer used for pseudo energy contribution in MFE calculations.
Definition soft.h:247
int ** energy_up
Energy contribution for stretches of unpaired nucleotides.
Definition soft.h:217
void * data
A pointer to the data object provided for for pseudo energy contribution functions of the generic sof...
Definition soft.h:264
int * energy_stack
Pseudo Energy contribution per base pair involved in a stack.
Definition soft.h:243
int * energy_bp
Energy contribution for base pairs.
Definition soft.h:228
The soft constraints data structure.
Definition soft.h:211
#define MIN2(A, B)
Get the minimum of two comparable values.
Definition basic.h:106
Functions and data structures for handling of secondary structure hard constraints.
Functions to deal with sets of energy parameters.
Functions to compute salt correction.
Functions and data structures for secondary structure soft constraints.
General utility- and helper-functions used throughout the ViennaRNA Package.