PUBLIC float alifold(const char **strings, char *structure){ int length, energy, s, n_seq; circ = 0; 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(); } for (s=0; strings[s]!=NULL; s++); n_seq = s; alloc_sequence_arrays(strings, &S, &S5, &S3, &a2s, &Ss, circ); make_pscores((const short **) S, strings, n_seq, structure); energy = fill_arrays((const char **)strings); backtrack((const char **)strings, 0); parenthesis_structure(structure, length); free_sequence_arrays(n_seq, &S, &S5, &S3, &a2s, &Ss); if (backtrack_type=='C') return (float) c[indx[length]+1]/(n_seq*100.); else if (backtrack_type=='M') return (float) fML[indx[length]+1]/(n_seq*100.); else return (float) f5[length]/(n_seq*100.); }
float fold(const char *string, char *structure) { int i, length, energy, bonus=0, bonus_cnt=0; circ = 0; length = (int) strlen(string); if (length>init_length) initialize_fold(length); if (fabs(P->temperature - temperature)>1e-6) update_fold_params(); encode_seq(string); BP = (int *)space(sizeof(int)*(length+2)); make_ptypes(S, structure); energy = fill_arrays(string); backtrack(string, 0); #ifdef PAREN parenthesis_structure(structure, length); #else letter_structure(structure, length); #endif /* check constraints */ for(i=1;i<=length;i++) { if((BP[i]<0)&&(BP[i]>-4)) { bonus_cnt++; if((BP[i]==-3)&&(structure[i-1]==')')) bonus++; if((BP[i]==-2)&&(structure[i-1]=='(')) bonus++; if((BP[i]==-1)&&(structure[i-1]!='.')) bonus++; } if(BP[i]>i) { int l; bonus_cnt++; for(l=1; l<=base_pair[0].i; l++) if((i==base_pair[l].i)&&(BP[i]==base_pair[l].j)) bonus++; } } if (bonus_cnt>bonus) fprintf(stderr,"\ncould not enforce all constraints\n"); bonus*=BONUS; free(S); free(S1); free(BP); energy += bonus; /*remove bonus energies from result */ if (backtrack_type=='C') return (float) c[indx[length]+1]/100.; else if (backtrack_type=='M') return (float) fML[indx[length]+1]/100.; else return (float) energy/100.; }
PUBLIC float alifold(const char **strings, char *structure){ int length, energy, s, n_seq; circular = 0; length = (int) strlen(strings[0]); #ifdef _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(); for (s=0; strings[s]!=NULL; s++); n_seq = s; alloc_sequence_arrays(strings, &S, &S5, &S3, &a2s, &Ss, circular); make_pscores((const short **) S, strings, n_seq, structure); energy = fill_arrays((const char **)strings); backtrack((const char **)strings, 0); #ifdef PAREN parenthesis_structure(structure, base_pair2, length); #else letter_structure(structure, base_pair2, length); #endif /* * Backward compatibility: * This block may be removed if deprecated functions * relying on the global variable "base_pair" vanishs from within the package! */ base_pair = base_pair2; /* { if(base_pair) free(base_pair); base_pair = (bondT *)space(sizeof(bondT) * (1+length/2)); memcpy(base_pair, base_pair2, sizeof(bondT) * (1+length/2)); } */ free_sequence_arrays(n_seq, &S, &S5, &S3, &a2s, &Ss); if (backtrack_type=='C') return (float) c[indx[length]+1]/(n_seq*100.); else if (backtrack_type=='M') return (float) fML[indx[length]+1]/(n_seq*100.); else return (float) f5[length]/(n_seq*100.); }