/* -*-C-*- */ /* this file contains code for folding circular RNAs */ /* it's #include'd into fold.c */ PRIVATE void fill_arrays_circ( vrna_fold_compound_t *vc, sect bt_stack[], int *bt){ /* variant of fold() for circular RNAs */ /* auxiliarry arrays: fM2 = multiloop region with exactly two stems, extending to 3' end for stupid dangles=1 case we also need: fM_d3 = multiloop region with >= 2 stems, starting at pos 2 (a pair (k,n) will form 3' dangle with pos 1) fM_d5 = multiloop region with >= 2 stems, extending to pos n-1 (a pair (1,k) will form a 5' dangle with pos n) */ int Hi, Hj, Ii, Ij, Ip, Iq, ip, iq, Mi; int *fM_d3, *fM_d5, Md3i, Md5i, FcMd3, FcMd5; int FcH, FcI, FcM, Fc, *fM2; int i,j, ij, u, length, new_c, fm, type; int *my_c, *my_fML, *indx, dangle_model, turn; vrna_param_t *P; char *ptype, *hard_constraints; short *S1; vrna_hc_t *hc; vrna_sc_t *sc; P = vc->params; ptype = vc->ptype; indx = vc->jindx; S1 = vc->sequence_encoding; dangle_model = P->model_details.dangles; turn = P->model_details.min_loop_size; hc = vc->hc; sc = vc->sc; hard_constraints = hc->matrix; my_c = vc->matrices->c; my_fML = vc->matrices->fML; fM2 = vc->matrices->fM2; length = vc->length; FcH = FcI = FcM = FcMd3 = FcMd5 = INF; if(hc->up_ext[1] >= length){ Fc = 0; if(sc){ if(sc->energy_up) Fc += sc->energy_up[1][length]; } } else { Fc = INF; } for(i = 1; i < length; i++) for(j = i + turn + 1; j <= length; j++){ u = length-j + i-1; if (uMLclosing; if (fmup_ml[1]){ fm = fM_d3[i]+my_c[indx[length]+i+1]+E_MLstem(type, -1, S1[1], P) + P->MLclosing; if (fmup_ml[i]){ fm = fM_d3[i-1]+my_c[indx[length]+i+1]+E_MLstem(type, S1[i], S1[1], P) + P->MLclosing; if (fmup_ml[length]){ fm = E_MLstem(type, S1[length], -1, P) + my_c[indx[i]+1] + fM_d5[i+1] + P->MLclosing; if (fmup_ml[i+1]){ fm = E_MLstem(type, S1[length], S1[i+1], P) + my_c[indx[i]+1] + fM_d5[i+2] + P->MLclosing; if (fm0)?Md5i:-Md5i; bt_stack[(*bt)].ml = 2; i = (Md5i>0)?Md5i+1 : -Md5i+2; /* let's backtrack fm_d5[Md5i+1] */ for (u=i+TURN; u0)?Md3i+1:-Md3i+1; bt_stack[(*bt)].j = length; bt_stack[(*bt)].ml = 2; i = (Md3i>0)? Md3i : -Md3i-1; /* let's backtrack fm_d3[Md3i] */ for (u=2+TURN; umatrices->FcH = FcH; vc->matrices->FcI = FcI; vc->matrices->FcM = FcM; vc->matrices->Fc = Fc; }