else if(!strncmp(buf,"differ_lib",10)) {/* Read in a variable number */ char *end; /* of distances to be used in */ int val; /* PairCoilDiffer scores. */ int do_each_dist_separately =0; if (!strncmp(buf,"differ_lib dim",14)) do_each_dist_separately = 1; if (!strncmp(buf,"differ_lib = all",16)) { /* For scscore.c will go through each dist on own*/ for (i=0; i<7; i++) differ_lib[i] = i; *differ_functnum = 1; *number_differ_lib = 7; printf("differ_lib = all dimensions"); } else { if (do_each_dist_separately) printf("differ_lib dimensions= "); else printf("differ_lib = "); tmp = strchr(buf, '='); tmp++; /* strip leading whitespace */ while(!isdigit(*tmp)&&*tmp) tmp++; while(end = strchrs(tmp, " \t\n\r")) { *end = 0; end++; /* strip leading whitespace */ while(*tmp&&!isdigit(*tmp)) tmp++; if(*tmp) { val = atoi(tmp); differ_lib[(*differ_functnum)++] = val; printf("%d ", val); } tmp = end; } printf("\n"); if (do_each_dist_separately) { *number_differ_lib = *differ_functnum; *differ_functnum=1; /* Each distance is a library to itself. */ } } } else if (!strncmp(buf, "New coil at reg shift",21)) *start_coil_at_reg_shift = 1; else if(!strncmp(buf,"differ class scores dimer",25)) { sscanf(buf,"differ class scores dimer = %s", differ_class_sc_filenames[0]); printf("differ class scores dimers = %s\n", differ_class_sc_filenames[0]); } else if(!strncmp(buf,"differ gauss_param",18)) { sscanf(buf,"differ gauss_param = %s",differ_gaussian_parameters); printf("differ gauss_param = %s\n",differ_gaussian_parameters); } else if(!strncmp(buf,"prior freq single",17)) { int the_table; if (!strncmp(buf,"prior freq single =",19)) { sscanf(buf,"prior freq single = %lf", &prior_freq_single[0]); for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) { prior_freq_single[the_table] = prior_freq_single[0]; printf("prior_freq_single %d = %lf\n", the_table, prior_freq_single[the_table]); } } /* All tables get same scale0. **/ else { sscanf(buf,"prior freq single %d", &the_table); sscanf(buf,"prior freq single %d = %lf", &the_table, &prior_freq_single[the_table-1]); printf("prior_freq_single %d = %lf\n", the_table,prior_freq_single[the_table-1]); } } else if(!strncmp(buf,"prior freq pair",15)) { int the_table; if (!strncmp(buf,"prior freq pair =",17)) { sscanf(buf,"prior freq pair = %lf", &prior_freq_pair[0]); for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) { prior_freq_pair[the_table] = prior_freq_pair[0]; printf("prior_freq_pair %d = %lf\n", the_table, prior_freq_pair[the_table]); } } /* All tables get same scale0. **/ else { sscanf(buf,"prior freq pair %d", &the_table); sscanf(buf,"prior freq pair %d = %lf", &the_table, &prior_freq_pair[the_table-1]); printf("prior_freq_pair %d = %lf\n", the_table,prior_freq_pair[the_table-1]); } } /***********************************************************/ else if(!strncmp(buf,"structurally important pos",26)) { char *end; int val; i =0; printf("structurally important pos = "); tmp = strchr(buf, '='); tmp++; /* strip leading whitespace */ while(!islower(*tmp)&&*tmp) tmp++; while(end = strchrs(tmp, " \t\n\r")) { *end = 0; end++; /* strip leading whitespace */ while(*tmp&&!islower(*tmp)) tmp++; if(*tmp) { val = (*tmp)- 'a'; if ((val>=7) || (val<0)) printf(" **ILLEGAL position %c ignored** ", 'a' + val); else { printf("%c ", 'a' + val); structural_pos[i]= val; i++; } } tmp = end; } printf("\n"); structural_pos[i] = -1; /* Flag that at end. */ } else if(!strncmp(buf,"good_turing",11)) { *good_turing_fixed_disc = 1; printf("Estimating prob using good_turing method.\n"); } else if(!strncmp(buf,"modified_good_turing",20)) { *good_turing_fixed_disc = 3; printf("Estimating prob using modified good_turing method.\n"); } else if(!strncmp(buf,"fixed_disc",10)) { *good_turing_fixed_disc = 2; printf("Estimating prob using fixed_discount method with discount determined by SCALE0.\n"); } /**********************************************************/ else if(!strncmp(buf,"zero freqs from dimers",22)) { *priors =-1; printf("zero freqs for trimers from dimers.\n"); } else if(!strncmp(buf,"add priors if less than dimer expectation",41)) { *priors =-2; printf("Add priors only if freq is less than dimer expectation.\n"); } else if(!strncmp(buf,"prior singles from",18)) { /* Reads in what to use as */ tmp = &buf[19]; /* One past space */ if (!strncmp(tmp,"dimers",6 )) { /* prior prob in estimating */ *priors = 1; printf("priors from dimers\n"); /* trimer table probs. */ } else if (!strncmp(tmp,"genbnk",6 )) { *priors = 2; printf("priors from genbnk\n"); } else if (!strncmp(tmp,"average",7 )) { *priors = 3; printf("priors from average of dimers and genbnk\n"); } } else if(!strncmp(buf,"zero freqp from dimers",22)) { *priorp =-1; printf("zero freqp for trimers from dimers.\n"); } else if(!strncmp(buf,"add priorp if less than dimer expectation",41)) { *priorp =-2; printf("Add priorp only if freq is less than dimer expectation.\n"); } else if(!strncmp(buf,"prior pairs from",16)) { /* Reads in what to use as */ tmp = &buf[17]; /* One past space */ if (!strncmp(tmp,"dimers",6 )) { /* prior prob in estimating */ *priorp = 1; printf("priorp from dimers\n"); /* trimer table probs. */ } else if (!strncmp(tmp,"genbnk",6 )) { *priorp = 2; printf("priorp from genbnk\n"); } else if (!strncmp(tmp,"average",7 )) { *priorp = 3; printf("priorp from average of dimers and genbnk\n"); } else if (!strncmp(tmp,"product of singles",18 )) { *priorp = 4; printf("priorp from product of singles\n"); } } /**************************************************************/ else if(!strncmp(buf,"differentiator window length",28)) { sscanf(buf,"differentiator window length = %d", differ_window_length); printf("differentiator window length = %d\n", *differ_window_length); } /**************************************************************/ /************************Round 2 of cuts **********************/ /**************************************************************/ else if(!strncmp(buf,"coil conflicts",14)) { if (!strncmp(buf,"coil conflicts dir",19)){ /* automate the name **/ sscanf(buf,"coil conflicts dir = %s",name); strcat(name,input_name); strcat(name,".coil_conflicts"); /**** Apend on the library distances. ***/ if (multi_functnum[0] == 1) { /* make sure do dimension scores */ lib_numb=0; while (lib_numb < number_multi_lib[0]) { sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]); lib_numb++; } sprintf(&buf[lib_numb],"_"); strncat(name,buf,number_multi_lib[0]+1); lib_numb=0; while (lib_numb < number_multi_lib[1]) { sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]); lib_numb++; } strncat(name,buf,number_multi_lib[1]); } } else sscanf(buf,"coil conflicts = %s",name); *flog_coil_conflicts = sopen(name,"w"); printf("coil conflicts = %s\n",name); } changed else if(!strncmp(buf,"table",5)) { /* Get location of postable file */ sscanf(buf,"table %d = %s",&i, name); if (strcmp("combination",name)) { /* If it is combination, just */ fpin[*number_tables] = sopen(name,"r"); /* increment number tables*/ } /* Otherwise open file. */ printf("table %d = %s\n",*number_tables,name); (*number_tables)++; fpin[*number_tables]= NULL; } to else if(!strncmp(buf,"table",5)) { /* Get location of postable file */ sscanf(buf,"table %d = %s",&i, name); fpin[i-1] = sopen(name,"r"); printf("table %d = %s\n",i,name); (*number_tables)++; fpin[i]= NULL; } changed if (!strncmp(buf,"multi_lib dim =",15)) { first_table=0; last_table=*number_tables; } /* All tables get same lib. **/ else { sscanf(buf,"multi_lib dim %d", &last_table); first_table = last_table-1; } } else if (!strncmp(buf,"multi_lib =",11)) { first_table=0; last_table=*number_tables; } /* All tables get same lib. **/ to if (!strncmp(buf,"multi_lib dim =",15)) { first_table=0; last_table=NUMBER_TABLES; } /* All tables get same lib. **/ else { sscanf(buf,"multi_lib dim %d", &last_table); first_table = last_table-1; } } else if (!strncmp(buf,"multi_lib =",11)) { first_table=0; last_table= NUMBER_TABLES; } /* All tables get same lib. **/ cut if (*weighted_avg) strcat(name,"_WtdAvg"); else if (!strncmp(buf,"weighted_avg", 12)) { sscanf(buf, "weighted_avg = %d", weighted_avg); /* 0 means just avg. res score over coil. */ /* 1 means do weighted avg. by likelihoods */ if ( (*weighted_avg !=0) &&(*weighted_avg !=1)) { fprintf(stderr,"\n Illegal weighted_avg method. Defaults to 0.\n"); *weighted_avg = 0; } else fprintf(stderr,"weighted_avg = %d\n", *weighted_avg); } } cut else if(!strncmp(buf,"tab diff stats",14)) { sscanf(buf,"tab diff stats = %s",table_diff_stats_filename); printf("tablediff stats = %s\n",table_diff_stats_filename); } else if(!strncmp(buf,"weightfile outname",18)) { sscanf(buf,"weightfile outname = %s",weightfile_outname); printf("weightfile outname = %s\n",weightfile_outname); } changed else if(!strncmp(buf,"class scores combo",18)) { sscanf(buf,"class scores combo %d with init prob %lf = %s",&i, &init_class_prob[*number_classes], class_sc_filenames[0][*number_classes]); printf("combo class scores %d = %s with init prob %lf\n", *number_classes,class_sc_filenames[0][*number_classes], init_class_prob[*number_classes]); /* likelihood lines. */ (*number_classes)++; class_sc_filenames[0][*number_classes][0]= ','; } else if(!strncmp(buf,"class scores max",16)) { sscanf(buf,"class scores max %d with init prob %lf = %s",&i, &init_class_prob[number_max_classes], class_sc_filenames[1][number_max_classes]); printf("max class scores %d = %s with init prob %lf\n", number_max_classes,class_sc_filenames[1][number_max_classes], init_class_prob[number_max_classes]); /* likelihood lines. */ number_max_classes++; class_sc_filenames[1][number_max_classes][0]= ','; } to else if(!strncmp(buf,"class scores combo",18)) { sscanf(buf,"class scores combo %d with init prob %lf = %s",&i, &init_class_prob[i-1], class_sc_filenames[0][i-1]); printf("combo class scores %d = %s with init prob %lf\n", i,class_sc_filenames[0][i-1], init_class_prob[*number_classes]); /* likelihood lines. */ class_sc_filenames[0][i][0]= ','; } else if(!strncmp(buf,"class scores max",16)) { sscanf(buf,"class scores max %d with init prob %lf = %s",&i, &init_class_prob[i-1], class_sc_filenames[1][i-1]); printf("max class scores %d = %s with init prob %lf\n", i,class_sc_filenames[1][i-1], init_class_prob[i-1]); /* likelihood lines. */ class_sc_filenames[1][i][0]= ','; CUT else if(!strncmp(buf,"average differentiator by coil window",37)) { *which_differentiator = 4; printf("The differentiator score is over the entire coiled region\n"); } else if(!strncmp(buf,"differentiator by coil window",29)) { *which_differentiator = 3; printf("The differentiator score is over the entire coiled region\n"); } else if(!strncmp(buf,"differentiator by window score",30)) { *which_differentiator = 1; printf("The differentiator residue score is the score of the window starting at that residue\n"); } else if(!strncmp(buf,"differentiator by max-min window score",38)) { *which_differentiator = 2; printf("The differentiator residue score is the scores for the max and min window containing that residue\n"); } Completely rewrote stuff to read in multi_lib to deal with variables num_dist and combined_dist. Cut else if(!strncmp(buf,"differ class scores trimer",26)) { sscanf(buf,"differ class scores trimer = %s", differ_class_sc_filenames[1]); printf("differ class scores trimers = %s\n", differ_class_sc_filenames[1]); } Changed lib_numb=0; while (lib_numb < number_multi_lib[0]) { sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]); lib_numb++; } sprintf(&buf[lib_numb],"_"); strncat(name,buf,number_multi_lib[0]+1); lib_numb=0; while (lib_numb < number_multi_lib[1]) { sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]); lib_numb++; } strncat(name,buf,number_multi_lib[1]); to while (lib_numb < num_dist[0]) { sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]); lib_numb++; } sprintf(&buf[lib_numb],"_"); strncat(name,buf,num_dist[0]+1); lib_numb=0; while (lib_numb < num_dist[1]) { sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]); lib_numb++; } strncat(name,buf,num_dist[1]); Changed /**** Apend on the library distances. ***/ if (multi_functnum[0] == 1) { /* make sure do dimension scores */ lib_numb=0; to if (combine_dist[0] == 0) Cut class_sc_filenames[0][number_classes][0]= ','; and class_sc_filenames[1][number_max_classes][0]= ','; } from when reading in class filenames. Modified stuff that reads in "coil scores = ...." so can also read it in as "seq scores = ...." and seq by_coil_or_seq based on if used "coil" or "seq". Therefore, could eliminate else if (!strncmp(buf,"By coil",7)) *by_coil_or_seq = 0; else if (!strncmp(buf,"By seq",6)) *by_coil_or_seq =2; but kept else if (!strncmp(buf,"By seq pos regions",18)) *by_coil_or_seq =1;