/* -*-C-*- */ /* this file contains code for alifolding circular RNAs */ /* it's #include'd into alifold.c */ float circalifold(const char **strings, char *structure) { /* variant of alifold() 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 *fM2, Fc, FcH, FcI, FcM, Hi, Hj, Ii, Ij, Ip, Iq, Mi; int FcMd3, FcMd5; int i,j, p,q,length, energy; int n_seq, psc, s=0; int *type; circular = 1; /* if (!uniq_ML) {uniq_ML=1; init_length=-1;} */ length = (int) strlen(strings[0]); #ifdef USE_OPENMP /* always init everything since all global static variables are uninitialized when entering a thread */ init_alifold(length); #else if (length > init_length) init_alifold(length); #endif if (fabs(P->temperature - temperature)>1e-6) update_alifold_params(); oldAliEn=1; /* TODO allow new gap treatment in alicircfold() */ for (s=0; strings[s]!=NULL; s++); n_seq = s; type = (int *) space(n_seq*sizeof(int)); alloc_sequence_arrays(strings, &S, &S5, &S3, &a2s, &Ss, circular); make_pscores((const short **) S, strings, n_seq, structure); /* compute all arrays used by fold() for linear RNA */ energy = fill_arrays((const char **) strings); /* extra arrays for circfold() */ fM2 = (int *) space(sizeof(int)*(length+2)); FcH = FcI= FcM = FcMd3= FcMd5= Fc = INF; for (i=1; iMAXLOOP) break; qmin = u1+i-1+length-MAXLOOP; if (qminMAXLOOP) continue; for (energy = s=0; sMLclosing; if (fm