1 else if(!strncmp(buf,"differ_lib",10)) {/* Read in a variable number */
2 char *end; /* of distances to be used in */
3 int val; /* PairCoilDiffer scores. */
4 int do_each_dist_separately =0;
6 if (!strncmp(buf,"differ_lib dim",14))
7 do_each_dist_separately = 1;
9 if (!strncmp(buf,"differ_lib = all",16))
11 /* For scscore.c will go through each dist on own*/
15 *number_differ_lib = 7;
16 printf("differ_lib = all dimensions");
20 if (do_each_dist_separately)
21 printf("differ_lib dimensions= ");
22 else printf("differ_lib = ");
24 tmp = strchr(buf, '=');
26 /* strip leading whitespace */
27 while(!isdigit(*tmp)&&*tmp) tmp++;
28 while(end = strchrs(tmp, " \t\n\r")) {
31 /* strip leading whitespace */
32 while(*tmp&&!isdigit(*tmp)) tmp++;
35 differ_lib[(*differ_functnum)++] = val;
42 if (do_each_dist_separately) {
43 *number_differ_lib = *differ_functnum;
45 /* Each distance is a library to itself. */
52 else if (!strncmp(buf, "New coil at reg shift",21))
53 *start_coil_at_reg_shift = 1;
56 else if(!strncmp(buf,"differ class scores dimer",25)) {
58 sscanf(buf,"differ class scores dimer = %s",
59 differ_class_sc_filenames[0]);
60 printf("differ class scores dimers = %s\n",
61 differ_class_sc_filenames[0]);
65 else if(!strncmp(buf,"differ gauss_param",18)) {
66 sscanf(buf,"differ gauss_param = %s",differ_gaussian_parameters);
67 printf("differ gauss_param = %s\n",differ_gaussian_parameters);
71 else if(!strncmp(buf,"prior freq single",17)) {
73 if (!strncmp(buf,"prior freq single =",19)) {
74 sscanf(buf,"prior freq single = %lf", &prior_freq_single[0]);
75 for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) {
76 prior_freq_single[the_table] = prior_freq_single[0];
77 printf("prior_freq_single %d = %lf\n", the_table,
78 prior_freq_single[the_table]);
80 } /* All tables get same scale0. **/
82 sscanf(buf,"prior freq single %d", &the_table);
83 sscanf(buf,"prior freq single %d = %lf", &the_table,
84 &prior_freq_single[the_table-1]);
85 printf("prior_freq_single %d = %lf\n",
86 the_table,prior_freq_single[the_table-1]);
89 else if(!strncmp(buf,"prior freq pair",15)) {
91 if (!strncmp(buf,"prior freq pair =",17)) {
92 sscanf(buf,"prior freq pair = %lf", &prior_freq_pair[0]);
93 for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) {
94 prior_freq_pair[the_table] = prior_freq_pair[0];
95 printf("prior_freq_pair %d = %lf\n", the_table,
96 prior_freq_pair[the_table]);
98 } /* All tables get same scale0. **/
100 sscanf(buf,"prior freq pair %d", &the_table);
101 sscanf(buf,"prior freq pair %d = %lf", &the_table,
102 &prior_freq_pair[the_table-1]);
103 printf("prior_freq_pair %d = %lf\n",
104 the_table,prior_freq_pair[the_table-1]);
109 /***********************************************************/
110 else if(!strncmp(buf,"structurally important pos",26)) {
115 printf("structurally important pos = ");
116 tmp = strchr(buf, '=');
118 /* strip leading whitespace */
119 while(!islower(*tmp)&&*tmp) tmp++;
120 while(end = strchrs(tmp, " \t\n\r")) {
123 /* strip leading whitespace */
124 while(*tmp&&!islower(*tmp)) tmp++;
127 if ((val>=7) || (val<0))
128 printf(" **ILLEGAL position %c ignored** ", 'a' + val);
130 printf("%c ", 'a' + val);
131 structural_pos[i]= val;
138 structural_pos[i] = -1; /* Flag that at end. */
141 else if(!strncmp(buf,"good_turing",11)) {
142 *good_turing_fixed_disc = 1;
143 printf("Estimating prob using good_turing method.\n");
145 else if(!strncmp(buf,"modified_good_turing",20)) {
146 *good_turing_fixed_disc = 3;
147 printf("Estimating prob using modified good_turing method.\n");
149 else if(!strncmp(buf,"fixed_disc",10)) {
150 *good_turing_fixed_disc = 2;
151 printf("Estimating prob using fixed_discount method with discount determined by SCALE0.\n");
153 /**********************************************************/
154 else if(!strncmp(buf,"zero freqs from dimers",22)) {
156 printf("zero freqs for trimers from dimers.\n");
159 else if(!strncmp(buf,"add priors if less than dimer expectation",41)) {
161 printf("Add priors only if freq is less than dimer expectation.\n");
164 else if(!strncmp(buf,"prior singles from",18)) {
165 /* Reads in what to use as */
166 tmp = &buf[19]; /* One past space */
167 if (!strncmp(tmp,"dimers",6 )) { /* prior prob in estimating */
169 printf("priors from dimers\n"); /* trimer table probs. */
171 else if (!strncmp(tmp,"genbnk",6 )) {
173 printf("priors from genbnk\n");
175 else if (!strncmp(tmp,"average",7 )) {
177 printf("priors from average of dimers and genbnk\n");
181 else if(!strncmp(buf,"zero freqp from dimers",22)) {
183 printf("zero freqp for trimers from dimers.\n");
185 else if(!strncmp(buf,"add priorp if less than dimer expectation",41)) {
187 printf("Add priorp only if freq is less than dimer expectation.\n");
190 else if(!strncmp(buf,"prior pairs from",16)) {
191 /* Reads in what to use as */
192 tmp = &buf[17]; /* One past space */
193 if (!strncmp(tmp,"dimers",6 )) { /* prior prob in estimating */
195 printf("priorp from dimers\n"); /* trimer table probs. */
197 else if (!strncmp(tmp,"genbnk",6 )) {
199 printf("priorp from genbnk\n");
201 else if (!strncmp(tmp,"average",7 )) {
203 printf("priorp from average of dimers and genbnk\n");
206 else if (!strncmp(tmp,"product of singles",18 )) {
208 printf("priorp from product of singles\n");
211 /**************************************************************/
212 else if(!strncmp(buf,"differentiator window length",28)) {
213 sscanf(buf,"differentiator window length = %d",
214 differ_window_length);
215 printf("differentiator window length = %d\n",
216 *differ_window_length);
222 /**************************************************************/
223 /************************Round 2 of cuts **********************/
224 /**************************************************************/
226 else if(!strncmp(buf,"coil conflicts",14)) {
227 if (!strncmp(buf,"coil conflicts dir",19)){ /* automate the name **/
228 sscanf(buf,"coil conflicts dir = %s",name);
229 strcat(name,input_name);
230 strcat(name,".coil_conflicts");
232 /**** Apend on the library distances. ***/
233 if (multi_functnum[0] == 1) { /* make sure do dimension scores */
235 while (lib_numb < number_multi_lib[0]) {
236 sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
238 sprintf(&buf[lib_numb],"_");
239 strncat(name,buf,number_multi_lib[0]+1);
243 while (lib_numb < number_multi_lib[1]) {
244 sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
246 strncat(name,buf,number_multi_lib[1]);
250 else sscanf(buf,"coil conflicts = %s",name);
251 *flog_coil_conflicts = sopen(name,"w");
252 printf("coil conflicts = %s\n",name);
256 else if(!strncmp(buf,"table",5)) { /* Get location of postable file */
257 sscanf(buf,"table %d = %s",&i, name);
258 if (strcmp("combination",name)) { /* If it is combination, just */
259 fpin[*number_tables] = sopen(name,"r"); /* increment number tables*/
260 } /* Otherwise open file. */
261 printf("table %d = %s\n",*number_tables,name);
263 fpin[*number_tables]= NULL;
268 else if(!strncmp(buf,"table",5)) { /* Get location of postable file */
269 sscanf(buf,"table %d = %s",&i, name);
270 fpin[i-1] = sopen(name,"r");
271 printf("table %d = %s\n",i,name);
278 if (!strncmp(buf,"multi_lib dim =",15)) {
279 first_table=0; last_table=*number_tables;
280 } /* All tables get same lib. **/
282 sscanf(buf,"multi_lib dim %d", &last_table);
283 first_table = last_table-1;
286 else if (!strncmp(buf,"multi_lib =",11)) {
287 first_table=0; last_table=*number_tables;
288 } /* All tables get same lib. **/
292 if (!strncmp(buf,"multi_lib dim =",15)) {
293 first_table=0; last_table=NUMBER_TABLES;
294 } /* All tables get same lib. **/
297 sscanf(buf,"multi_lib dim %d", &last_table);
298 first_table = last_table-1;
301 else if (!strncmp(buf,"multi_lib =",11)) {
302 first_table=0; last_table= NUMBER_TABLES;
303 } /* All tables get same lib. **/
310 strcat(name,"_WtdAvg");
313 else if (!strncmp(buf,"weighted_avg", 12)) {
314 sscanf(buf, "weighted_avg = %d", weighted_avg);
315 /* 0 means just avg. res score over coil. */
316 /* 1 means do weighted avg. by likelihoods */
317 if ( (*weighted_avg !=0) &&(*weighted_avg !=1)) {
318 fprintf(stderr,"\n Illegal weighted_avg method. Defaults to 0.\n");
321 else fprintf(stderr,"weighted_avg = %d\n", *weighted_avg);
330 else if(!strncmp(buf,"tab diff stats",14)) {
331 sscanf(buf,"tab diff stats = %s",table_diff_stats_filename);
332 printf("tablediff stats = %s\n",table_diff_stats_filename);
334 else if(!strncmp(buf,"weightfile outname",18)) {
335 sscanf(buf,"weightfile outname = %s",weightfile_outname);
336 printf("weightfile outname = %s\n",weightfile_outname);
342 else if(!strncmp(buf,"class scores combo",18)) {
343 sscanf(buf,"class scores combo %d with init prob %lf = %s",&i,
344 &init_class_prob[*number_classes],
345 class_sc_filenames[0][*number_classes]);
346 printf("combo class scores %d = %s with init prob %lf\n",
347 *number_classes,class_sc_filenames[0][*number_classes],
348 init_class_prob[*number_classes]); /* likelihood lines. */
350 class_sc_filenames[0][*number_classes][0]= ',';
354 else if(!strncmp(buf,"class scores max",16)) {
355 sscanf(buf,"class scores max %d with init prob %lf = %s",&i,
356 &init_class_prob[number_max_classes],
357 class_sc_filenames[1][number_max_classes]);
358 printf("max class scores %d = %s with init prob %lf\n",
359 number_max_classes,class_sc_filenames[1][number_max_classes],
360 init_class_prob[number_max_classes]); /* likelihood lines. */
361 number_max_classes++;
362 class_sc_filenames[1][number_max_classes][0]= ',';
366 else if(!strncmp(buf,"class scores combo",18)) {
367 sscanf(buf,"class scores combo %d with init prob %lf = %s",&i,
368 &init_class_prob[i-1],
369 class_sc_filenames[0][i-1]);
370 printf("combo class scores %d = %s with init prob %lf\n",
371 i,class_sc_filenames[0][i-1],
372 init_class_prob[*number_classes]); /* likelihood lines. */
373 class_sc_filenames[0][i][0]= ',';
377 else if(!strncmp(buf,"class scores max",16)) {
378 sscanf(buf,"class scores max %d with init prob %lf = %s",&i,
379 &init_class_prob[i-1],
380 class_sc_filenames[1][i-1]);
381 printf("max class scores %d = %s with init prob %lf\n",
382 i,class_sc_filenames[1][i-1],
383 init_class_prob[i-1]); /* likelihood lines. */
384 class_sc_filenames[1][i][0]= ',';
389 else if(!strncmp(buf,"average differentiator by coil window",37)) {
390 *which_differentiator = 4;
391 printf("The differentiator score is over the entire coiled region\n");
395 else if(!strncmp(buf,"differentiator by coil window",29)) {
396 *which_differentiator = 3;
397 printf("The differentiator score is over the entire coiled region\n");
399 else if(!strncmp(buf,"differentiator by window score",30)) {
400 *which_differentiator = 1;
401 printf("The differentiator residue score is the score of the window starting at that residue\n");
403 else if(!strncmp(buf,"differentiator by max-min window score",38)) {
404 *which_differentiator = 2;
405 printf("The differentiator residue score is the scores for the max and min window containing that residue\n");
411 Completely rewrote stuff to read in multi_lib to deal with variables
412 num_dist and combined_dist.
417 else if(!strncmp(buf,"differ class scores trimer",26)) {
419 sscanf(buf,"differ class scores trimer = %s",
420 differ_class_sc_filenames[1]);
421 printf("differ class scores trimers = %s\n",
422 differ_class_sc_filenames[1]);
430 while (lib_numb < number_multi_lib[0]) {
431 sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
433 sprintf(&buf[lib_numb],"_");
434 strncat(name,buf,number_multi_lib[0]+1);
437 while (lib_numb < number_multi_lib[1]) {
438 sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
440 strncat(name,buf,number_multi_lib[1]);
444 while (lib_numb < num_dist[0]) {
445 sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
447 sprintf(&buf[lib_numb],"_");
448 strncat(name,buf,num_dist[0]+1);
451 while (lib_numb < num_dist[1]) {
452 sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
454 strncat(name,buf,num_dist[1]);
459 /**** Apend on the library distances. ***/
460 if (multi_functnum[0] == 1) { /* make sure do dimension scores */
463 if (combine_dist[0] == 0)
468 class_sc_filenames[0][number_classes][0]= ',';
470 class_sc_filenames[1][number_max_classes][0]= ',';
473 from when reading in class filenames.
477 Modified stuff that reads in "coil scores = ...."
478 so can also read it in as "seq scores = ...."
479 and seq by_coil_or_seq based on if used "coil" or "seq".
480 Therefore, could eliminate
481 else if (!strncmp(buf,"By coil",7))
483 else if (!strncmp(buf,"By seq",6))
486 else if (!strncmp(buf,"By seq pos regions",18))