1 #ifndef VIENNA_RNA_PACKAGE_INTERIOR_LOOPS_H 2 #define VIENNA_RNA_PACKAGE_INTERIOR_LOOPS_H 5 #include "ViennaRNA/energy_par.h" 11 # define INLINE inline 20 #define ON_SAME_STRAND(I,J,C) (((I)>=(C))||((J)<(C))) 117 PRIVATE INLINE
int E_IntLoop_Co(
int type,
149 ubf_eval_int_loop(
int i,
162 unsigned char type_2,
174 if((cp < 0) || (ON_SAME_STRAND(i, p, cp) && ON_SAME_STRAND(q, j, cp))){
175 energy =
E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
178 Si = ON_SAME_STRAND(i, i1, cp) ? si : -1;
179 Sj = ON_SAME_STRAND(j1, j, cp) ? sj : -1;
180 energy = E_IntLoop_Co(rtype[type], rtype[type_2],
225 ubf_eval_ext_int_loop(
int i,
238 unsigned char type_2,
243 int energy, u1, u2, u3;
249 energy =
E_IntLoop(u2, u1 + u3, type, type_2, si, sj, sp, sq, P);
259 if(u1 + u2 + u3 == 0)
285 int nl, ns, u, energy;
288 if (n1>n2) { nl=n1; ns=n2;}
292 return P->stack[type][type_2];
295 energy = (nl<=
MAXLOOP)?P->bulge[nl]:
296 (P->bulge[30]+(
int)(P->lxc*log(nl/30.)));
297 if (nl==1) energy += P->stack[type][type_2];
299 if (type>2) energy += P->TerminalAU;
300 if (type_2>2) energy += P->TerminalAU;
307 return P->int11[type][type_2][si1][sj1];
310 energy = P->int21[type][type_2][si1][sq1][sj1];
312 energy = P->int21[type_2][type][sq1][si1][sp1];
316 energy = (nl+1<=
MAXLOOP)?(P->internal_loop[nl+1]) : (P->internal_loop[30]+(int)(P->lxc*log((nl+1)/30.)));
317 energy +=
MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
318 energy += P->mismatch1nI[type][si1][sj1] + P->mismatch1nI[type_2][sq1][sp1];
324 return P->int22[type][type_2][si1][sp1][sq1][sj1];}
326 energy = P->internal_loop[5]+P->ninio[2];
327 energy += P->mismatch23I[type][si1][sj1] + P->mismatch23I[type_2][sq1][sp1];
334 energy = (u <=
MAXLOOP) ? (P->internal_loop[u]) : (P->internal_loop[30]+(int)(P->lxc*log((u)/30.)));
336 energy +=
MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
338 energy += P->mismatchI[type][si1][sj1] + P->mismatchI[type_2][sq1][sp1];
355 int ul, us, no_close = 0;
359 if ((noGUclosure) && ((type2==3)||(type2==4)||(type==3)||(type==4)))
362 if (u1>u2) { ul=u1; us=u2;}
366 z = P->expstack[type][type2];
370 if (ul==1) z *= P->expstack[type][type2];
372 if (type>2) z *= P->expTermAU;
373 if (type2>2) z *= P->expTermAU;
379 return (
FLT_OR_DBL)(P->expint11[type][type2][si1][sj1]);
383 return (
FLT_OR_DBL)(P->expint21[type][type2][si1][sq1][sj1]);
385 return (
FLT_OR_DBL)(P->expint21[type2][type][sq1][si1][sp1]);
388 z = P->expinternal[ul+us] * P->expmismatch1nI[type][si1][sj1] * P->expmismatch1nI[type2][sq1][sp1];
389 return (
FLT_OR_DBL)(z * P->expninio[2][ul-us]);
394 return (
FLT_OR_DBL)(P->expint22[type][type2][si1][sp1][sq1][sj1]);
396 z = P->expinternal[5]*P->expmismatch23I[type][si1][sj1]*P->expmismatch23I[type2][sq1][sp1];
401 z = P->expinternal[ul+us] * P->expmismatchI[type][si1][sj1] * P->expmismatchI[type2][sq1][sp1];
402 return (
FLT_OR_DBL)(z * P->expninio[2][ul-us]);
409 E_IntLoop_Co(
int type,
423 int energy, ci, cj, cp, cq, d3, d5, d5_2, d3_2, tmm, tmm_2;
426 if(type > 2) energy += P->TerminalAU;
427 if(type_2 > 2) energy += P->TerminalAU;
429 if(!dangles)
return energy;
431 ci = ON_SAME_STRAND(i, i + 1, cutpoint);
432 cj = ON_SAME_STRAND(j - 1, j, cutpoint);
433 cp = ON_SAME_STRAND(p - 1, p, cutpoint);
434 cq = ON_SAME_STRAND(q, q + 1, cutpoint);
436 d3 = ci ? P->dangle3[type][si1] : 0;
437 d5 = cj ? P->dangle5[type][sj1] : 0;
438 d5_2 = cp ? P->dangle5[type_2][sp1] : 0;
439 d3_2 = cq ? P->dangle3[type_2][sq1] : 0;
441 tmm = (cj && ci) ? P->mismatchExt[type][sj1][si1] : d5 + d3;
442 tmm_2 = (cp && cq) ? P->mismatchExt[type_2][sp1][sq1] : d5_2 + d3_2;
444 if(dangles == 2)
return energy + tmm + tmm_2;
448 if(q+2 < j){ energy += tmm + tmm_2;}
449 else if(q+2 == j){ energy += (cj && cq) ?
MIN2(tmm + d5_2, tmm_2 + d3) : tmm + tmm_2;}
450 else energy += d3 + d5_2;
453 if(q+2 < j){ energy += (ci && cp) ?
MIN2(tmm + d3_2, tmm_2 + d5) : tmm + tmm_2;}
455 energy +=
MIN2(tmm,
MIN2(tmm_2,
MIN2(d5 + d5_2, d3 + d3_2)));
457 else energy +=
MIN2(d3, d5_2);
460 if(q+2 < j){ energy += d5 + d3_2;}
461 else if(q+2 == j){ energy +=
MIN2(d5, d3_2);}
int dangles
Specifies the dangle model used in any energy evaluation (0,1,2 or 3)
Definition: model.h:194
#define MAXLOOP
Definition: energy_const.h:29
vrna_md_t model_details
Model details to be used in the recursions.
Definition: params.h:93
vrna_md_t model_details
Model details to be used in the recursions.
Definition: params.h:149
double FLT_OR_DBL
Typename for floating point number in partition function computations.
Definition: data_structures.h:48
The most basic data structure required by many functions throughout the RNAlib.
Definition: data_structures.h:454
int noGUclosure
Do not allow loops to be closed by GU pair.
Definition: model.h:221
The datastructure that contains temperature scaled energy parameters.
Definition: params.h:55
int * energy_stack
Pseudo Energy contribution per base pair involved in a stack.
Definition: constraints_soft.h:107
vrna_callback_sc_energy * f
A function pointer used for pseudo energy contribution in MFE calculations.
Definition: constraints_soft.h:111
General utility- and helper-functions used throughout the ViennaRNA Package.
int vrna_eval_int_loop(vrna_fold_compound_t *vc, int i, int j, int k, int l)
Various data structures and pre-processor macros.
The soft constraints data structure.
Definition: constraints_soft.h:101
#define INF
Definition: energy_const.h:17
Functions to deal with sets of energy parameters.
The data structure that contains temperature scaled Boltzmann weights of the energy parameters...
Definition: params.h:99
int ** energy_up
Energy contribution for stretches of unpaired nucleotides.
Definition: constraints_soft.h:102
#define VRNA_DECOMP_PAIR_IL
Indicator for interior loop decomposition step.
Definition: constraints.h:72
Base pair stack element.
Definition: data_structures.h:222
Functions and data structures for constraining secondary structure predictions and evaluation...
int * energy_bp
Energy contribution for base pairs.
Definition: constraints_soft.h:103
int vrna_BT_stack(vrna_fold_compound_t *vc, int *i, int *j, int *en, vrna_bp_stack_t *bp_stack, int *stack_count)
Backtrack a stacked pair closed by .
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: interior_loops.h:274
#define MIN2(A, B)
Get the minimum of two comparable values.
Definition: utils.h:115
int vrna_BT_int_loop(vrna_fold_compound_t *vc, int *i, int *j, int en, vrna_bp_stack_t *bp_stack, int *stack_count)
Backtrack an interior loop closed by .
int dangles
Switch the energy model for dangling end contributions (0, 1, 2, 3)
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: interior_loops.h:345
void * data
A pointer to the data object provided for for pseudo energy contribution functions of the generic sof...
Definition: constraints_soft.h:128