/* Last changed Time-stamp: <2006-05-08 20:04:18 ivo> */ /* Ineractive Access to folding Routines c Ivo L Hofacker Vienna RNA package */ #include #include #include #include #include #include #include "fold.h" #include "part_func.h" #include "fold_vars.h" #include "utils.h" #include "PS_dot.h" extern float Lfold(char *string, char *structure, int winsize); extern void read_parameter_file(const char fname[]); extern int pfl_fold(char *sequence, int winSize, int pairdist, float cutoff, struct plist **pl); extern void init_pf_foldLP(int length); extern void free_pf_arraysLP(void); /*@unused@*/ static char rcsid[] = "$Id: RNAplfold.c,v 1.3 2006/05/10 15:13:18 ivo Exp $"; #define PRIVATE static static char scale[] = "....,....1....,....2....,....3....,....4" "....,....5....,....6....,....7....,....8"; PRIVATE void usage(void); /*--------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { char *string, *line; char *structure=NULL, *cstruc=NULL; char fname[30], ffname[20]; char *ParamFile=NULL; char *ns_bases=NULL, *c; int i, length, l, sym,r; int istty; int noconv=0; int winsize=70; int pairdist=0; float cutoff=0.01; int hit; plist *pl; do_backtrack = 1; string=NULL; dangles=2; for (i=1; iwinsize) { fprintf(stderr, "pairdist (-L %d) should be <= winsize (-W %d);" "Setting pairdist=winsize\n",pairdist, winsize); pairdist=winsize; } do { /* main loop: continue until end of file */ if (istty) { printf("\nInput string (upper or lower case); @ to quit\n"); printf("%s\n", scale); } fname[0]='\0'; if ((line = get_line(stdin))==NULL) break; /* skip comment lines and get filenames */ while ((*line=='*')||(*line=='\0')||(*line=='>')) { if (*line=='>') (void) sscanf(line, ">%12s", fname); printf("%s\n", line); free(line); if ((line = get_line(stdin))==NULL) break; } if ((line ==NULL) || (strcmp(line, "@") == 0)) break; string = (char *) space(strlen(line)+1); (void) sscanf(line,"%s",string); free(line); length = (int) strlen(string); structure = (char *) space((unsigned) length+1); for (l = 0; l < length; l++) { string[l] = toupper(string[l]); if (!noconv && string[l] == 'T') string[l] = 'U'; } if (istty) printf("length = %d\n", length); /* initialize_fold(length); */ update_fold_params(); if (length= 5) { pf_scale = -1; init_pf_foldLP(length); hit=pfl_fold(string, winsize, pairdist, cutoff, &pl); free_pf_arraysLP(); if (fname[0]!='\0') { strcpy(ffname, fname); strcat(ffname, "_dp.ps"); } else strcpy(ffname, "plfold_dp.ps"); PS_dot_plot_turn(string, pl, ffname, pairdist); free(pl); if (cstruc!=NULL) free(cstruc); (void) fflush(stdout); } free(string); free(structure); } while (1); return 0; } PRIVATE void usage(void) { nrerror("usage:\n" "RNAplfold [-L span] [-W winsize]\n" " [-T temp] [-4] [-d[0|1|2]] [-noGU] [-noCloseGU]\n" " [-noLP] [-P paramfile] [-nsp pairs] [-noconv]\n"); }