X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=sources%2Fmulticoil%2Finterface_cuts.c;fp=sources%2Fmulticoil%2Finterface_cuts.c;h=1c0872fada119f01c459566d8f9c2185f7721408;hb=1431c641556befdbff5922788061394f2c870a80;hp=0000000000000000000000000000000000000000;hpb=4e8f16a99a41f25bcaf0772796d4d3b8f63aa38f;p=jpred.git diff --git a/sources/multicoil/interface_cuts.c b/sources/multicoil/interface_cuts.c new file mode 100644 index 0000000..1c0872f --- /dev/null +++ b/sources/multicoil/interface_cuts.c @@ -0,0 +1,1054 @@ +from interface.h cut #define MAX_TABLE_NUMBER 4 + +put /* #define COMPUTE_GAUSSIAN_VERSION */ in options.h +put #define NUMBER_TABLES 2 in scconst.h +put #define NUMBER_CLASES 3 in scconst.h +put #define MAX_TABLE_NUMBER 2 /* Same as NUMBER_TABLES. **/ in scconst.h +put #define NUM_DIM_IN_ORIG_MATRIX 14 in scconst.h +and in interface.c +for both_class_covars[][][][] and both_class_means[][][] made the max size +of the matrix be NUM_DIM_IN_ORIG_MATRIX (Then changed in multivariate_like.c +where pass these in). (get_gauss_param_all_classes2(), compute_submatrices2()) + +In scconst.h, put +#ifdef COMPUTE_GAUSSIAN_VERSION + #define MAX_NUM_SCORE_DIM 14 +#else + #define MAX_NUM_SCORE_DIM 6 +#endif + + + double m_single[MAX_TABLE_NUMBER], + b_single[MAX_TABLE_NUMBER]; /* Like line for singlecoil. */ + + + /*************************** PAIRDIFF LIKELIHOOD STUFF. *********************/ + double differ_determinants[MAX_CLASS_NUMBER]; + double differ_inverse_covars[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM]; + double differ_covars_submatrix[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM]; + double differ_means_submatrix[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM]; + + int number_differ_score_dim =0; + int number_differ_lib=0; + int differ_window_length = 28; + int which_differentiator=1; /** Default is just the score for the window **/ + /** 2 means to give each residue a pair of scores**/ + /** corresponding to the max and min of the **/ + /** windows containing it. **/ + int differ_functnum=0; +#endif + + +#ifdef TEST_VERSION + char differ_class_sc_filenames[MAX_CLASS_NUMBER][MAXLINE]; + double differ_means[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM]; + double differ_covars[MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM]; + char differ_gauss_param[MAXLINE]; + char differ_lib[MAXFUNCTNUM]; /* Distance values for PairCoilDiff */ + extern int differ_functnum; +#ifdef TEST_VERSION + +#ifdef TEST_VERSION + double prior_freq_single[MAX_TABLE_NUMBER], + prior_freq_pair[MAX_TABLE_NUMBER]; + int which_priors =0, which_priorp =0; + int good_turing_fixed_disc =0; /** If set to 1 do the good_turing_fixed_disc estimate of probs*/ + int structural_pos[POSNUM+1]; /** Holds list of which positions are **/ + /** structurally important. All others **/ + /** get genbnk probabilities.... **/ + /** Value -1 indicates no more entries. **/ +#endif + + int old_num_dim_differ =0; + /* The gauss param file for multiple distances is */ + /* contains the parameters for all distances. */ +#ifdef TEST_VERSION + compute_multivariate_num_differ_dim(&number_differ_score_dim, + number_differ_lib, + differ_functnum, &old_num_dim_differ, + which_differentiator); +#endif + +cut +double both_covars_submatrix[2][MAX_CLASS_NUMBER][MAX_NUM_SCORE_DIM][MAX_NUM_SCORE_DIM]; + + + +#ifdef TEST_VERSION +/*************************************************************************/ +/******************Now do gauss parameters for PairCoilDiff method. *****/ +/*************************************************************************/ +/**** Note the "2" parameter represents that are 2 classes (dimers, trimers)***/ +/**** not three, since just differentiating so don't need pdb-. ************/ + + if (differ_gauss_param[0] != ',') { + char differ_lib_hack[2][MAXFUNCTNUM]; + /** If are computing max and min window scores, **/ + /** then need to extract both dimenion i and **/ + /** i + old_num_dim_differ/2. Treat them like they **/ + /** were from another table. ***/ + + + get_gauss_param_all_classes2(differ_class_sc_filenames, + old_num_dim_differ, + differ_means, differ_covars, + 2, differ_gauss_param); + + if (which_differentiator ==2) { + for (i=0; i0) { /*** Get gaussian param for the classes. */ + if (ftotal_like) { /** Want to output total gauss like over classes*/ + for (i=0; i1) + local_lib = &multi_lib[tablenum][dist]; + else local_lib = multi_lib[tablenum]; +by + for (dist=0; dist1) + local_lib = &multi_lib[tablenum][dist]; + else local_lib = multi_lib[tablenum]; + dimension = compute_dimension2(tablenum, dist, + num_dist, combine_dist); + + + + +/*************************************************************************/ +/**********************ADD BACK EVENTUALLY *******************************/ +From scoreseq cut + + + case PairCoilDiff: + functnum = differ_functnum; + for (dimension=0; dimension1) { + local_lib = &differ_lib[dimension]; + } + else local_lib = differ_lib; + + + PairCoilDifferDimension(mode, sequence, local_lib, &maxsc, + all_preproc_offsets[preproc_table], + all_preprocess_like[preproc_table], + all_scores, + all_offsets, dimension, + Offset_to_Use, number_differ_score_dim, + bound); + + } + break; + + +/************************************************************************/ +changed + + if ( (Method != MultiCoil) && (Method !=PairCoilDiff)) + get_offsets(all_scores, sequence,all_offsets,number_tables); +to + if (Method != MultiCoil) + get_offsets(all_scores, sequence,all_offsets,NUMBER_TABLES); + else if (!(mode & RAW_OUT)) { + + +CUT + +/***********Do conversions on PairCoilDiff scores, using preprocessor. **/ +/*********** Note for differentiator there are only 2 possible classes **/ +/*********** (dimer and trimer). **********/ + if (Method == PairCoilDiff) { + convert_raw_scores_to_gauss_prob_like2(all_scores,sequence.seqlen, + number_tables, differ_means_submatrix, + differ_inverse_covars,differ_determinants, 2, + init_class_prob, number_differ_score_dim, + 0, bound, Offset_to_Use,0); + if (Preprocessor_Method == MultiCoil) + preproc_res_like = &all_preprocess_like[preproc_table+3][0][0]; + else preproc_res_like = &all_preprocess_like[preproc_table][0][0]; + + +/* Only use window scores that lie completely in coil */ + if ( (which_differentiator == 3) || (which_differentiator ==4)) + zero_out_non_coils(all_scores, all_preprocess_like[preproc_table], + sequence.seqlen, bound); + + if (which_differentiator == 1) + zero_out_bad_windows(differ_window_length, + all_scores,all_preprocess_like[preproc_table], + sequence.seqlen,bound); + + copy_offsets(all_preproc_offsets[preproc_table],sequence, + all_offsets,2, all_scores, Offset_to_Use); + if (Coil_Score) /* Value of 1 means do average, 2 means do max. */ + for (tablenum=0; tablenum<2; tablenum++) { + average_score_over_coils3(sequence, all_scores[tablenum+3], + all_scores[tablenum], + preproc_res_like, + /** Total Coil Like. **/ + weighted_avg, offset_to_use, + all_preproc_offsets[preproc_table], + start_coil_at_reg_shift, bound, + Coil_Score -1); + } + } + + + +cut + if (rescore_seq==-1 && !scored_already && (Method==PairCoilDiff)) { + if ( (which_differentiator == 3) || (which_differentiator ==4)) + zero_out_non_coils(all_scores, all_preprocess_like[preproc_table], + sequence.seqlen, bound); + if (which_differentiator == 1) /* Only use window scores that lie */ + zero_out_bad_windows(differ_window_length, /* completely in coil */ + all_scores, all_preprocess_like[preproc_table], + sequence.seqlen,bound); + } + + +changed + get_seq_scores(seq_scores, sequence, all_scores[0+3], + all_scores[1+3],bound, weighted_avg); + +to + get_seq_scores(seq_scores, sequence, all_scores[0+3], + all_scores[1+3],bound); + + +cut + + + else if (Method == PairCoilDiff) { + if (Preprocessor_Method == MultiCoil) + preproc_res_like = &all_preprocess_like[preproc_table+3][0][0]; + else preproc_res_like = &all_preprocess_like[preproc_table][0][0]; + + + for (tablenum=0; tablenum<2; tablenum++) + average_score_over_coils3(sequence, all_scores[tablenum+3], + all_scores[tablenum], + preproc_res_like, + /** Total Coil Like. **/ + weighted_avg, offset_to_use, + all_offsets[tablenum], + start_coil_at_reg_shift, bound, + Coil_Score -1); + } + + + +changed +ShowSeq(char lib[MAXFUNCTNUM], char differ_lib[MAXFUNCTNUM], + char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM], + double *m, double *b, + double *m_single, double *b_single, + int mode, int rescore_sequence, int rescore_preproc, double bound) +to +ShowSeq(char lib[MAXFUNCTNUM], + char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM], + double *m, double *b, + double *m_single, double *b_single, + int mode, int rescore_sequence, int rescore_preproc, double bound) + +changed + + + all_scores = ScoreSeq(lib, differ_lib, multi_lib, m, b,m_single, b_single, + mode, table, + method, preprocessor_method, + offset_to_use, &maxscore, + rescore_sequence, rescore_preproc, bound); +to + all_scores = ScoreSeq(lib, multi_lib, m, b,m_single, b_single, + mode, table, + method, preprocessor_method, + offset_to_use, &maxscore, + rescore_sequence, rescore_preproc, bound); + +/******************************ROUND 3 OF CHANGES **************************/ + +changed + initialize(&num_dist[0], window_length, scale0s, + scale0p,fpin[0], + &likelihoods[0][0], &pir_name[0], print, gauss_param, + &mode); +to + initialize(&num_dist[0], window_length, scale0s, + scale0p,fpin[0], + &likelihoods[0][0], &pir_name[0], print, gauss_param, + &mode, init_clas_prob); + + + +changed +void output_seq(char lib[MAXFUNCTNUM],char differ_lib[MAXFUNCTNUM], + char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM], + double *m,double *b, + double *m_single, double *b_single, + int mode, + double log_bound,FILE *flog, FILE *flog_coil_conflicts, + FILE *fout_coils, + FILE *fout, + int avg_max, + int main_method, int main_preprocessor_method, + int main_table) +to +void output_seq(char lib[MAXFUNCTNUM],char differ_lib[MAXFUNCTNUM], + char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM], + double *m,double *b, + double *m_single, double *b_single, + int mode, + double log_bound,FILE *flog, + FILE *fout_coils, + FILE *fout, + int avg_max, + int main_method, int main_preprocessor_method, + int main_table) +cut + if (flog_coil_conflicts) sclose(flog_coil_conflicts); + + + +changed + + + convert_raw_scores_to_gauss_prob_like2(all_preprocess_like,sequence.seqlen, + NUMBER_TABLES,means_submatrix,inverse_covars, + determinants, NUMBER_CLASSES, init_class_prob, + number_score_dim, + mode & ONLY_COILED_CLASSES, + bound,Offset_to_Use, 1); + to + convert_raw_scores_to_gauss_prob_like2(all_preprocess_like,sequence.seqlen, + NUMBER_TABLES,means_submatrix,inverse_covars, + determinants, NUMBER_CLASSES, init_class_prob, + number_score_dim, + mode & ONLY_COILED_CLASSES, + bound,Offset_to_Use); + twice. + + + + + +Changed + + if (ftotal_like) { /** Want to output total gauss like over classes*/ + for (i=0; i