/* -*-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; /* if (!uniq_ML) {uniq_ML=1; init_length=-1;} */ length = (int) strlen(strings[0]); if (length>init_length) init_alifold(length); if ((P==NULL)||(fabs(P->temperature - temperature)>1e-6)) { update_fold_params(); P = scale_parameters(); } 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)); S = (short **) space(n_seq*sizeof(short *)); S5 = (short **) space(n_seq*sizeof(short *)); S3 = (short **) space(n_seq*sizeof(short *)); a2s= (unsigned short **)space(n_seq*sizeof(unsigned short *)); Ss = (char **)space(n_seq*sizeof(char *)); for (s=0; sMAXLOOP) break; qmin = u1+i-1+length-MAXLOOP; if (qminMAXLOOP) continue; for (energy = s=0; sMLclosing; if (fm