1 from interface.h cut #define MAX_TABLE_NUMBER 4
3 put /* #define COMPUTE_GAUSSIAN_VERSION */ in options.h
4 put #define NUMBER_TABLES 2 in scconst.h
5 put #define NUMBER_CLASES 3 in scconst.h
6 put #define MAX_TABLE_NUMBER 2 /* Same as NUMBER_TABLES. **/ in scconst.h
7 put #define NUM_DIM_IN_ORIG_MATRIX 14 in scconst.h
9 for both_class_covars[][][][] and both_class_means[][][] made the max size
10 of the matrix be NUM_DIM_IN_ORIG_MATRIX (Then changed in multivariate_like.c
11 where pass these in). (get_gauss_param_all_classes2(), compute_submatrices2())
14 #ifdef COMPUTE_GAUSSIAN_VERSION
15 #define MAX_NUM_SCORE_DIM 14
17 #define MAX_NUM_SCORE_DIM 6
21 double m_single[MAX_TABLE_NUMBER],
22 b_single[MAX_TABLE_NUMBER]; /* Like line for singlecoil. */
25 /*************************** PAIRDIFF LIKELIHOOD STUFF. *********************/
26 double differ_determinants[MAX_CLASS_NUMBER];
27 double differ_inverse_covars[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM];
28 double differ_covars_submatrix[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM];
29 double differ_means_submatrix[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM];
31 int number_differ_score_dim =0;
32 int number_differ_lib=0;
33 int differ_window_length = 28;
34 int which_differentiator=1; /** Default is just the score for the window **/
35 /** 2 means to give each residue a pair of scores**/
36 /** corresponding to the max and min of the **/
37 /** windows containing it. **/
38 int differ_functnum=0;
43 char differ_class_sc_filenames[MAX_CLASS_NUMBER][MAXLINE];
44 double differ_means[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM];
45 double differ_covars[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM];
46 char differ_gauss_param[MAXLINE];
47 char differ_lib[MAXFUNCTNUM]; /* Distance values for PairCoilDiff */
48 extern int differ_functnum;
52 double prior_freq_single[MAX_TABLE_NUMBER],
53 prior_freq_pair[MAX_TABLE_NUMBER];
54 int which_priors =0, which_priorp =0;
55 int good_turing_fixed_disc =0; /** If set to 1 do the good_turing_fixed_disc estimate of probs*/
56 int structural_pos[POSNUM+1]; /** Holds list of which positions are **/
57 /** structurally important. All others **/
58 /** get genbnk probabilities.... **/
59 /** Value -1 indicates no more entries. **/
62 int old_num_dim_differ =0;
63 /* The gauss param file for multiple distances is */
64 /* contains the parameters for all distances. */
66 compute_multivariate_num_differ_dim(&number_differ_score_dim,
68 differ_functnum, &old_num_dim_differ,
69 which_differentiator);
73 double both_covars_submatrix[2][MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM];
78 /*************************************************************************/
79 /******************Now do gauss parameters for PairCoilDiff method. *****/
80 /*************************************************************************/
81 /**** Note the "2" parameter represents that are 2 classes (dimers, trimers)***/
82 /**** not three, since just differentiating so don't need pdb-. ************/
84 if (differ_gauss_param[0] != ',') {
85 char differ_lib_hack[2][MAXFUNCTNUM];
86 /** If are computing max and min window scores, **/
87 /** then need to extract both dimenion i and **/
88 /** i + old_num_dim_differ/2. Treat them like they **/
89 /** were from another table. ***/
92 get_gauss_param_all_classes2(differ_class_sc_filenames,
94 differ_means, differ_covars,
95 2, differ_gauss_param);
97 if (which_differentiator ==2) {
98 for (i=0; i<number_differ_score_dim/2; i++) {
99 differ_lib_hack[0][i] = differ_lib[i];
100 differ_lib_hack[1][i] = differ_lib[i];
102 compute_submatrices2(differ_means,differ_means_submatrix,
104 differ_inverse_covars,
105 differ_determinants, differ_lib_hack,
106 old_num_dim_differ/2, old_num_dim_differ/2,
107 number_differ_score_dim/2, number_differ_score_dim/2,
111 compute_submatrices2(differ_means,differ_means_submatrix,
113 differ_inverse_covars,
114 differ_determinants, differ_lib,
115 old_num_dim_differ, 0,
116 number_differ_score_dim, 0,
120 for (class=0; class<2; class++) {
121 fprintf(stderr,"\n\nDiffer Mean Submatrix %d:\n",class);
122 print_matrix(differ_means_submatrix[class],1,
123 number_differ_score_dim,stderr);
124 fprintf(stderr,"\n\nDiffer Inver Covar Submatrix %d:\n", class);
125 print_matrix(differ_inverse_covars[class],
126 number_differ_score_dim,number_differ_score_dim,
132 fprintf(stderr,"\nDet0 =%lf, det1= %lf\n",
133 differ_determinants[0],differ_determinants[1]);
135 fprintf(stderr,"\nnew_num_dim_differ=%d, old_num_dim_differ=%d,", number_differ_score_dim, old_num_dim_differ);
143 case XK_A: /** Switch between unweighted avg and **/
144 case XK_a: /** weighted avg coil score. **/
145 weighted_avg = !weighted_avg;
146 if (Coil_Score !=0) { /** CoilScore ==0 means not doing coil score. **/
147 ShowSeq(lib,differ_lib,multi_lib,
148 m,b,m_single,b_single,mode,-1,-1, bound);
149 if (zoomptr) Zoomer();
155 case XK_B: /** For CoilScore, change how deal with reg shift. **/
156 start_coil_at_reg_shift = !start_coil_at_reg_shift;
157 if (Coil_Score !=0) { /** CoilScore ==0 means not doing coil score. **/
158 ShowSeq(lib,differ_lib,multi_lib,
159 m,b,m_single,b_single,mode,-1,-1, bound);
160 if (zoomptr) Zoomer();
167 offset_to_use = (offset_to_use +1) % 8; /* Cycle through offsets */
168 /*** switch_gauss_param(offset_to_use); **/
169 ShowSeq(lib,differ_lib,multi_lib,
170 m,b,m_single,b_single,mode,1,1, bound);
171 if (zoomptr) Zoomer();
173 case XK_s: /* Use single probabilities. */
175 if (mode & PAIRCOIL_PAIRS) {
176 mode -= PAIRCOIL_PAIRS; /** Turn it off **/
177 ShowSeq(lib,differ_lib,multi_lib,
178 m,b,m_single,b_single,mode,1,1, bound);
179 if (zoomptr) Zoomer();
183 case XK_l: /* Use pair probabilities at lib distances */
185 if (!(mode & PAIRCOIL_PAIRS)) {
186 mode |= PAIRCOIL_PAIRS; /* Turn it on. */
187 ShowSeq(lib,differ_lib,multi_lib,
188 m,b,m_single,b_single,mode,1,1, bound);
189 if (zoomptr) Zoomer();
197 initialize(&number_classes, &number_multi_lib[0], window_length, scale0s,
199 &likelihoods[0][0], &pir_name[0], print, gauss_param,
201 &mode, prior_freq_single, prior_freq_pair,
204 initialize(&number_classes, &number_multi_lib[0], window_length, scale0s,
206 &likelihoods[0][0], &pir_name[0], print, gauss_param,
207 &mode, prior_freq_single, prior_freq_pair,
213 OpenScreen(int mode, double log_bound, FILE *fin, FILE *flog,
214 FILE* flog_coil_conflicts,FILE *fout_coils,
216 double *m, double *b, double *m_single, double *b_single,
217 char lib[MAXFUNCTNUM],
218 char differ_lib[MAXFUNCTNUM],
219 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
221 int main_preprocessor_method,
222 int *seqcnt, int which_priors, int which_priorp,
223 double prior_freq_single[MAX_TABLE_NUMBER],
224 double prior_freq_pair[MAX_TABLE_NUMBER],
225 int good_turing_fixed_disc, int structural_pos[POSNUM+1])
228 OpenScreen(int mode, double log_bound, FILE *fin, FILE *flog,
229 FILE* flog_coil_conflicts,FILE *fout_coils,
231 double *m, double *b, double *m_single, double *b_single,
232 char lib[MAXFUNCTNUM],
233 char differ_lib[MAXFUNCTNUM],
234 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
236 int main_preprocessor_method,
241 finish_log(mode,log_bound,fin,flog,flog_coil_conflicts,fout_coils,
243 m,b, m_single, b_single,
244 lib,differ_lib,multi_lib, main_method, main_table,
245 main_preprocessor_method, seqcnt, avg_max, which_priors,
246 which_priorp, prior_freq_single, prior_freq_pair,
247 good_turing_fixed_disc, structural_pos);
250 finish_log(mode,log_bound,fin,flog,flog_coil_conflicts,fout_coils,
252 m,b, m_single, b_single,
253 lib,differ_lib,multi_lib, main_method, main_table,
254 main_preprocessor_method, seqcnt, avg_max);
257 if (mode & TST_MODE0)
258 recalc_prob(sequence, 0, mode, which_priors, which_priorp,
259 prior_freq_single, prior_freq_pair, good_turing_fixed_disc,
261 if (mode & TST_MODE1)
262 recalc_prob(sequence,1, mode, which_priors, which_priorp,
263 prior_freq_single, prior_freq_pair, good_turing_fixed_disc,
266 if (mode & TST_MODE0)
267 recalc_prob(sequence, 0, mode);
268 if (mode & TST_MODE1)
269 recalc_prob(sequence,1, mode);
272 /*************************************************************************/
273 /******** ROUND 2 of cuts. *******************************************/
274 /*************************************************************************/
276 int number_classes=0;
277 int weighted_avg = 0; /* Determines which method for determining coil */
278 /* score will be used in DimerTrimerScore. */
279 char table_diff_stat_filename[MAXLINE]="/dev/null";
280 char weightfile_outname[MAXLINE]="/dev/null";
282 "key 'r': Cycle through offsets 0-7 for register (7=combo reg)",
283 "key 'b': For Coil score, toggle whether start new coils at",
284 " a register shift (break in structure).",
285 "key 'a': For Coil score, toggle between unweighted and weighted avg",
289 FILE *flog_coil_conflicts=NULL
290 extern int number_classes;
294 double upper_bound; /* In DEBUG_MODE (for printing out the predicted */
295 /* heptad repeat), scores in [bound,upper_bound] */
296 /* are printed in capital letters. */
301 initialize(&number_classes, &number_multi_lib[0], window_length, scale0s,
303 &likelihoods[0][0], &pir_name[0], print, gauss_param,
304 &mode, prior_freq_single, prior_freq_pair,
307 initialize(&number_multi_lib[0], window_length, scale0s,
309 &likelihoods[0][0], &pir_name[0], print, gauss_param,
314 get_defaults(argv[1], &mode, &log_bound, &fgin, fpin,
316 &flog, &flog_coil_conflicts,
317 &fout_coils, &by_coil_or_seq, likelihoods,
318 pir_name, lib, multi_lib,
319 &pair_functnum, multi_functnum,
320 print, &main_method, &main_preprocessor_method,
321 &main_table, &number_tables, &offset_to_use,
322 &avg_max, &weighted_avg, &Coil_Score,
323 table_diff_stat_filename, weightfile_outname,
324 &ps_res_per_line, &number_classes,
326 gauss_param, number_multi_lib,
328 &table_to_remove_from,
329 command_line, window_length, scale0s, scale0p,
330 &which_differentiator);
334 get_defaults(argv[1], &mode, &log_bound, &fgin, fpin,
337 &fout_coils, &by_coil_or_seq, likelihoods,
338 pir_name, lib, multi_lib,
339 &pair_functnum, multi_functnum,
340 print, &main_method, &main_preprocessor_method,
341 &main_table, &offset_to_use,
342 &avg_max, &Coil_Score,
345 gauss_param, number_multi_lib,
347 &table_to_remove_from,
348 command_line, window_length, scale0s, scale0p);
351 cut int old_num_dim_table[2];
352 int new_num_dim_table[2];
355 compute_multivariate_num_dim(mode, &number_score_dim,
356 number_multi_lib,multi_functnum, number_tables,
357 new_num_dim_table, old_num_dim_table);
362 if (number_classes >0) { /*** Get gaussian param for the classes. */
363 if (ftotal_like) { /** Want to output total gauss like over classes*/
364 for (i=0; i<number_classes; i++) /* for various init_prob settings. */
365 init_class_prob[i]=1; /** All 1 values is flag to just output */
366 init_totals(total_gauss_like); /** gauss values, not like values in */
367 } /** convert_raw_scores_to_gauss_like. */
371 if (ftotal_like) { /** Want to output total gauss like over classes*/
372 for (i=0; i<number_classes; i++) /* for various init_prob settings. */
373 init_class_prob[i]=1; /** All 1 values is flag to just output */
374 init_totals(total_gauss_like); /** gauss values, not like values in */
375 } /** convert_raw_scores_to_gauss_like. */
378 Replace int number_multi_lib[MAX_TABLE_NUMBER]
379 with int num_dist[MAX_TABLE_NUMBER] almost everywhere
381 in conjunction with replacing multi_functnum with a variable indicating
382 if distances are each a dimension, or if should combine into a single
385 int multi_functnum[MAX_TABLE_NUMBER]
387 int combine_dist[MAX_TABLE_NUMBER];
392 get_gauss_param_all_classes2(class_sc_filenames[i],
393 old_num_dim_table[0]+old_num_dim_table[1],
394 both_class_means[i], both_class_covars[i],
395 number_classes, gauss_param[i]);
397 get_gauss_param_all_classes2(class_sc_filenames[i],
398 6*combine_dist[0] + 1 +
399 6*combine_dist[1] + 1,
400 both_class_means[i], both_class_covars[i],
404 compute_submatrices2(both_class_means[i],both_means_submatrix[i],
405 both_class_covars[i],
406 both_inverse_covars[i],
407 both_determinants[i], multi_lib,
408 old_num_dim_table[0], old_num_dim_table[1],
409 new_num_dim_table[0], new_num_dim_table[1],
410 mode & MULTI_TRIMER_PAIRS);
412 compute_submatrices2(both_class_means[i],both_means_submatrix[i],
413 both_class_covars[i],
414 both_inverse_covars[i],
415 both_determinants[i], multi_lib,
416 6*combine_dist[0] + 1,
417 6*combine_dist[1] + 1
418 (num_dist[0]-1)*combine_dist[0] + 1,
419 (num_dist[1]-1)*combine_dist[1] + 1);
423 added number_score_dim = (num_dist[0]-1)*combine_dist[0] + 1 +
424 (num_dist[1]-1)*combine_dist[1] + 1;
429 log_file_header(flog, flog_coil_conflicts, mode,
430 argc, argv, avg_max, log_bound,
431 preprocessor_method, preproc_table, log_offset_to_use,
432 start_coil_at_reg_shift, weighted_avg, main_method,
436 if ( (mode & PRN_MODE) && flog ){
437 log_file_header(flog, mode,
438 argc, argv, avg_max, log_bound,
439 preprocessor_method, preproc_table, log_offset_to_use,
440 start_coil_at_reg_shift, main_method,
443 from that function, cut stuff for log_coil_conflicts
445 if (weighted_avg == 0) {
446 fprintf(flog, "\n Averaging over coils was done by coil length.");
448 else { /* weighted_avg ==1 */
449 fprintf(flog, "\n Averaging over coils was done using coil length weighted at each position by the preprocessor coil likelihood.");
456 PairCoilData(fgin,fpin,&number_tables, mode & PROLINE_FREE_MODE,
457 table_to_remove_from, argv[1], mode);
458 /* If fpin[1] != NULL this will call */
460 PairCoilData(fgin,fpin, mode & PROLINE_FREE_MODE,
461 table_to_remove_from, argv[1], mode);
465 get_likelihood_line(likelihoods, m, b, m_single, b_single,
466 lib, pair_functnum,pir_name,mode,number_tables);
469 get_likelihood_line(likelihoods, m, b, m_single, b_single,
470 lib, pair_functnum,pir_name,mode,NUMBER_TABLES);
474 OpenScreen(mode,log_bound,fin,flog,flog_coil_conflicts, fout_coils,
475 fout, m,b,m_single, b_single,
476 lib,differ_lib,multi_lib,
477 main_method,main_preprocessor_method, &seqnum);
479 OpenScreen(mode,log_bound,fin,flog, fout_coils,
480 fout, m,b,m_single, b_single,
482 main_method,main_preprocessor_method, &seqnum);
486 finish_log(mode,log_bound,fin,flog,fout_coils,
488 m,b, m_single, b_single,
489 lib,multi_lib, main_method, main_table,
490 main_preprocessor_method, seqcnt, avg_max);
492 finish_log(mode,log_bound,fin,flog,fout_coils,
494 m,b, m_single, b_single,
495 lib,multi_lib, main_method, main_table,
496 main_preprocessor_method, seqcnt, avg_max);
501 NextSeq(fin,lib,differ_lib,multi_lib,
502 m,b,m_single,b_single,
503 mode,bound,flog,flog_coil_conflicts,fout_coils,
504 fout, which_priors, which_priorp, prior_freq_single,
505 prior_freq_pair, good_turing_fixed_disc, structural_pos);
507 NextSeq(fin,lib,multi_lib,m,b,m_single,b_single,
508 mode,bound,flog,fout_coils,fout);
512 PrevSeq(fin,lib,differ_lib,multi_lib,
513 m,b,m_single,b_single,
514 mode,bound, which_priors,which_priorp, prior_freq_single,
515 prior_freq_pair, good_turing_fixed_disc, structural_pos);
517 PrevSeq(fin,lib,multi_lib,m,b,m_single,b_single,mode,bound);
520 changed ShowSeq(lib,differ_lib,multi_lib,
521 m,b,m_single,b_single,mode,1,0, bound);
523 ShowSeq(lib,multi_lib,m,b,m_single,b_single,mode,1,0, bound);
527 if (flog_coil_conflicts) sclose(flog_coil_conflicts);
531 type_class_score_convert(sequence,all_scores,bound,
532 mode & ONLY_COILED_CLASSES,number_tables,
535 type_class_score_convert(sequence,all_scores,bound,
536 mode & ONLY_COILED_CLASSES);
539 if (method == MultiCoil)
540 table = table % number_classes;
542 table = table % number_tables;
544 if (method == MultiCoil)
545 table = table % NUMBER_CLASSES;
547 table = table % NUMBER_TABLES;
551 NewSeq (int mode, Sequence sequence, int which_priors, int which_priorp,
552 double prior_freq_single[MAX_TABLE_NUMBER],
553 double prior_freq_pair[MAX_TABLE_NUMBER], int good_turing_fixed_disc,
554 int structural_pos[POSNUM+1])
556 NewSeq (int mode, Sequence sequence)
566 /*** For pos files coils, does a log file version of coil/seq score. **/
567 output_pos_scores(fout_coils, sequence, all_scores, log_bound, mode,
568 by_coil_or_seq, weighted_avg);
575 /*** For pos files coils, does a log file version of coil/seq score. **/
576 output_pos_scores(fout_coils, sequence, all_scores, log_bound, mode,
579 SO ALWAYS TO SEQUENCE SCORE and Weighted average (weighted by coil prob.).
584 if (flog_coil_conflicts)
585 coil_conflicts(mode,all_scores,all_scores,sequence, seqnum,log_bound,
586 log_bound,number_tables, flog_coil_conflicts,avg_max);
588 case PairCoilDiffAvg:
589 if (flog_coil_conflicts) {
591 coil_conflicts(mode,all_scores,all_preprocess_like,sequence, seqnum,
592 .5, log_bound, number_tables, flog_coil_conflicts,
600 else if (main_method == PairCoilDiff)
601 /* Output max score for each dimension. */
602 /** Had to do a hack since tuple_out2 expects number_lib */
603 /** to be array of size num_tab, so pass in 1 for num_tab */
604 tuple_output2(sequence, mode, fout, all_scores, 1,
605 &number_differ_lib,log_bound, number_differ_score_dim);
608 in preprocessor_score() changed
609 num_multilib= compute_num_multilib(tablenum, number_multi_lib,
610 mode & MULTI_TRIMER_PAIRS);
612 num_score_dim= combine_dist[tablenum]*num_dist[tablenum] +
613 (1-combine_dist[tablenum]);
615 functnum = multi_functnum[tablenum];
617 functnum = combine_dist[tablenum]*num_dist[tablenum] +
618 (1 - combine_dist[tablenum]);
621 average_score_over_coils3(sequence, all_preprocess_like[tablenum+3],
622 all_preprocess_like[tablenum],
623 all_preprocess_like[2+3],/** Total Coil Like. **/
624 weighted_avg, offset_to_use,
625 all_preproc_offsets[tablenum],
626 start_coil_at_reg_shift, bound,
629 average_score_over_coils3(sequence, all_preprocess_like[tablenum+3],
630 all_preprocess_like[tablenum],
631 all_preprocess_like[2+3],/** Total Coil Like. **/
633 all_preproc_offsets[tablenum],
634 start_coil_at_reg_shift, bound,
642 if (tablenum ==0) use_pairs =1; /* Use pairs for cctb */
643 else if (tablenum ==1) use_pairs = (mode & MULTI_TRIMER_PAIRS);
644 /* Do what config file said to do for trimers. **/
648 functnum = multi_functnum[tablenum]; /* For use in scscore.c **/
649 num_multilib = compute_num_multilib(tablenum,number_multi_lib,
650 for (dist=0; dist<num_multilib; dist++) {
651 if (number_multi_lib[tablenum] >1)
652 local_lib = &multi_lib[tablenum][dist];
653 else local_lib = multi_lib[tablenum];
655 for (dist=0; dist<num_score_dim; dist++) {
656 if (number_dist[tablenum] >1)
657 local_lib = &multi_lib[tablenum][dist];
658 else local_lib = multi_lib[tablenum];
659 dimension = compute_dimension2(tablenum, dist,
660 num_dist, combine_dist);
665 /*************************************************************************/
666 /**********************ADD BACK EVENTUALLY *******************************/
671 functnum = differ_functnum;
672 for (dimension=0; dimension<number_differ_lib; dimension++) {
673 if (number_differ_lib >1) {
674 local_lib = &differ_lib[dimension];
676 else local_lib = differ_lib;
679 PairCoilDifferDimension(mode, sequence, local_lib, &maxsc,
680 all_preproc_offsets[preproc_table],
681 all_preprocess_like[preproc_table],
683 all_offsets, dimension,
684 Offset_to_Use, number_differ_score_dim,
691 /************************************************************************/
694 if ( (Method != MultiCoil) && (Method !=PairCoilDiff))
695 get_offsets(all_scores, sequence,all_offsets,number_tables);
697 if (Method != MultiCoil)
698 get_offsets(all_scores, sequence,all_offsets,NUMBER_TABLES);
699 else if (!(mode & RAW_OUT)) {
704 /***********Do conversions on PairCoilDiff scores, using preprocessor. **/
705 /*********** Note for differentiator there are only 2 possible classes **/
706 /*********** (dimer and trimer). **********/
707 if (Method == PairCoilDiff) {
708 convert_raw_scores_to_gauss_prob_like2(all_scores,sequence.seqlen,
709 number_tables, differ_means_submatrix,
710 differ_inverse_covars,differ_determinants, 2,
711 init_class_prob, number_differ_score_dim,
712 0, bound, Offset_to_Use,0);
713 if (Preprocessor_Method == MultiCoil)
714 preproc_res_like = &all_preprocess_like[preproc_table+3][0][0];
715 else preproc_res_like = &all_preprocess_like[preproc_table][0][0];
718 /* Only use window scores that lie completely in coil */
719 if ( (which_differentiator == 3) || (which_differentiator ==4))
720 zero_out_non_coils(all_scores, all_preprocess_like[preproc_table],
721 sequence.seqlen, bound);
723 if (which_differentiator == 1)
724 zero_out_bad_windows(differ_window_length,
725 all_scores,all_preprocess_like[preproc_table],
726 sequence.seqlen,bound);
728 copy_offsets(all_preproc_offsets[preproc_table],sequence,
729 all_offsets,2, all_scores, Offset_to_Use);
730 if (Coil_Score) /* Value of 1 means do average, 2 means do max. */
731 for (tablenum=0; tablenum<2; tablenum++) {
732 average_score_over_coils3(sequence, all_scores[tablenum+3],
733 all_scores[tablenum],
735 /** Total Coil Like. **/
736 weighted_avg, offset_to_use,
737 all_preproc_offsets[preproc_table],
738 start_coil_at_reg_shift, bound,
746 if (rescore_seq==-1 && !scored_already && (Method==PairCoilDiff)) {
747 if ( (which_differentiator == 3) || (which_differentiator ==4))
748 zero_out_non_coils(all_scores, all_preprocess_like[preproc_table],
749 sequence.seqlen, bound);
750 if (which_differentiator == 1) /* Only use window scores that lie */
751 zero_out_bad_windows(differ_window_length, /* completely in coil */
752 all_scores, all_preprocess_like[preproc_table],
753 sequence.seqlen,bound);
758 get_seq_scores(seq_scores, sequence, all_scores[0+3],
759 all_scores[1+3],bound, weighted_avg);
762 get_seq_scores(seq_scores, sequence, all_scores[0+3],
763 all_scores[1+3],bound);
769 else if (Method == PairCoilDiff) {
770 if (Preprocessor_Method == MultiCoil)
771 preproc_res_like = &all_preprocess_like[preproc_table+3][0][0];
772 else preproc_res_like = &all_preprocess_like[preproc_table][0][0];
775 for (tablenum=0; tablenum<2; tablenum++)
776 average_score_over_coils3(sequence, all_scores[tablenum+3],
777 all_scores[tablenum],
779 /** Total Coil Like. **/
780 weighted_avg, offset_to_use,
781 all_offsets[tablenum],
782 start_coil_at_reg_shift, bound,
789 ShowSeq(char lib[MAXFUNCTNUM], char differ_lib[MAXFUNCTNUM],
790 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
791 double *m, double *b,
792 double *m_single, double *b_single,
793 int mode, int rescore_sequence, int rescore_preproc, double bound)
795 ShowSeq(char lib[MAXFUNCTNUM],
796 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
797 double *m, double *b,
798 double *m_single, double *b_single,
799 int mode, int rescore_sequence, int rescore_preproc, double bound)
804 all_scores = ScoreSeq(lib, differ_lib, multi_lib, m, b,m_single, b_single,
806 method, preprocessor_method,
807 offset_to_use, &maxscore,
808 rescore_sequence, rescore_preproc, bound);
810 all_scores = ScoreSeq(lib, multi_lib, m, b,m_single, b_single,
812 method, preprocessor_method,
813 offset_to_use, &maxscore,
814 rescore_sequence, rescore_preproc, bound);
816 /******************************ROUND 3 OF CHANGES **************************/
819 initialize(&num_dist[0], window_length, scale0s,
821 &likelihoods[0][0], &pir_name[0], print, gauss_param,
824 initialize(&num_dist[0], window_length, scale0s,
826 &likelihoods[0][0], &pir_name[0], print, gauss_param,
827 &mode, init_clas_prob);
832 void output_seq(char lib[MAXFUNCTNUM],char differ_lib[MAXFUNCTNUM],
833 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
835 double *m_single, double *b_single,
837 double log_bound,FILE *flog, FILE *flog_coil_conflicts,
841 int main_method, int main_preprocessor_method,
844 void output_seq(char lib[MAXFUNCTNUM],char differ_lib[MAXFUNCTNUM],
845 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
847 double *m_single, double *b_single,
849 double log_bound,FILE *flog,
853 int main_method, int main_preprocessor_method,
856 if (flog_coil_conflicts) sclose(flog_coil_conflicts);
863 convert_raw_scores_to_gauss_prob_like2(all_preprocess_like,sequence.seqlen,
864 NUMBER_TABLES,means_submatrix,inverse_covars,
865 determinants, NUMBER_CLASSES, init_class_prob,
867 mode & ONLY_COILED_CLASSES,
868 bound,Offset_to_Use, 1);
870 convert_raw_scores_to_gauss_prob_like2(all_preprocess_like,sequence.seqlen,
871 NUMBER_TABLES,means_submatrix,inverse_covars,
872 determinants, NUMBER_CLASSES, init_class_prob,
874 mode & ONLY_COILED_CLASSES,
875 bound,Offset_to_Use);
884 if (ftotal_like) { /** Want to output total gauss like over classes*/
885 for (i=0; i<number_classes; i++) /* for various init_prob settings. */
889 if (ftotal_like) { /** Want to output total gauss like over classes*/
890 for (i=0; i<NUMBER_CLASSES; i++) /* for various init_prob settings. */
895 get_gauss_param_all_classes2(class_sc_filenames[i],
896 num_table_dimensions(7,combine_dist[0]) +
897 num_table_dimensions(7,combine_dist[1]),
898 both_class_means[i], both_class_covars[i],
899 number_classes, gauss_param[i]);
901 get_gauss_param_all_classes2(class_sc_filenames[i],
902 num_table_dimensions(7,combine_dist[0]) +
903 num_table_dimensions(7,combine_dist[1]),
904 both_class_means[i], both_class_covars[i],
905 NUMBER_CLASSES, gauss_param[i]);
909 preproc_table = (preproc_table +1) % number_classes;
911 preproc_table = (preproc_table +1) % NUMBER_CLASSES;
915 type_class_score_convert(sequence,all_scores,bound,
916 mode & ONLY_COILED_CLASSES, number_tables,
919 type_class_score_convert(sequence,all_scores,bound,
920 mode & ONLY_COILED_CLASSES);
924 get_gauss_param_all_classes2(class_sc_filenames[i],
925 num_table_dimensions(7,combine_dist[0]) +
926 num_table_dimensions(7,combine_dist[1]),
927 both_class_means[i], both_class_covars[i],
928 NUMBER_CLASSES, gauss_param[i]);
930 get_gauss_param_all_classes2(class_sc_filenames[i],
931 num_table_dimensions(7,combine_dist[0]) +
932 num_table_dimensions(7,combine_dist[1]),
933 both_class_means[i], both_class_covars[i],
938 strcat(MethodTitle,"WtdAvg");
939 else strcat(MethodTitle,"Avg");
943 strcat(MethodTitle,"WtdAvg");
946 From function switch_gauss_param() cut
947 else if (Method == PairCoilDiff) {
948 determinants= &differ_determinants[0];
949 inverse_covars= &differ_inverse_covars[0][0][0];
950 means_submatrix= &differ_means_submatrix[0][0];
954 /********************************************************************/
958 void output_seq(char lib[MAXFUNCTNUM],char lib_differ[MAXFUNCTNUM],
959 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
961 double *m_single, double *b_single,
963 double bound, FILE *flog, FILE *flog_coil_conflicts,
967 int main_method, int main_preprocessor_method, int main_table);
972 void output_seq(char lib[MAXFUNCTNUM],
973 char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
975 double *m_single, double *b_single,
977 double log_bound,FILE *flog,
981 int main_method, int main_preprocessor_method,
988 if (preprocessor_method == MultiCoil)
989 preproc_table = (preproc_table +1) % NUMBER_CLASSES;
991 preproc_table = (preproc_table +1) % NUMBER_TABLES;
992 ShowSeq(lib,multi_lib,m,b,m_single,b_single,mode,0,2, bound);
993 if (zoomptr) Zoomer();
997 if (method == MultiCoil)
998 table = (table +1) % NUMBER_CLASSES;
1000 table = (table +1) % NUMBER_TABLES;
1001 ShowSeq(lib,multi_lib,m,b,m_single,b_single,mode,0,0, bound);
1002 if (zoomptr) Zoomer();
1009 if (preprocessor_method == MultiCoil)
1010 preproc_table = (preproc_table +1) % NUMBER_CLASSES;
1011 else if (preprocessor_method == HMMCoil)
1012 preproc_table = (preproc_table +1) % NUMBER_TABLES;
1013 else preproc_table = 0;
1014 ShowSeq(lib,multi_lib,m,b,m_single,b_single,mode,0,2, bound);
1015 if (zoomptr) Zoomer();
1019 if (method == MultiCoil)
1020 table = (table +1) % NUMBER_CLASSES;
1021 else if (method == HMMCoil)
1022 table = (table +1) % NUMBER_TABLES;
1024 ShowSeq(lib,multi_lib,m,b,m_single,b_single,mode,0,0, bound);
1025 if (zoomptr) Zoomer();
1031 if (method == MultiCoil)
1032 table = table % NUMBER_CLASSES;
1034 table = table % NUMBER_TABLES;
1040 if (method == MultiCoil)
1041 table = table % NUMBER_CLASSES;
1042 else if (method == HMMCoil)
1043 table = table % NUMBER_TABLES;
1046 and similarly for xk_w
1049 get_likelihood_line(likelihoods, m, b, m_single, b_single,
1050 lib, pair_functnum,pir_name,mode,NUMBER_TABLES);
1052 get_likelihood_line(likelihoods, m, b, m_single, b_single,
1053 lib, pair_functnum,pir_name,mode,1);
1054 since PairCoil doesn't work well for trimer table.