2 void PairCoilData (FILE *fgin, FILE **fpin, int *number_tables,
3 int ProlineFree, int table_to_remove_from,
4 char *input_filename, int mode,
5 double prior_freq_single[MAX_TABLE_NUMBER],
6 double prior_freq_pair[MAX_TABLE_NUMBER], int which_priors,
7 int which_priorp, int good_turing,
8 int structural_pos[POSNUM+1])
10 void PairCoilData (FILE *fgin, FILE **fpin, int *number_tables,
11 int ProlineFree, int table_to_remove_from,
12 char *input_filename, int mode)
15 if (!(mode & WEIGHTED_PROBS)) {
17 set_unimportant_pos_to_genbnk(many_pprobs[i], many_pprobp[i],
18 gprobs, gprobp, structural_pos);
19 estimate_database_probs(i, pfreqs[i], ptotals[i], many_pprobs,
20 pfreqp[i], ptotalp[i], many_pprobp,
21 ProlineFree, which_priors, which_priorp,
23 prior_freq_pair[i], good_turing,
26 if (!(mode & WEIGHTED_PROBS)) {
27 estimate_database_probs(i, pfreqs[i], ptotals[i], many_pprobs,
28 pfreqp[i], ptotalp[i], many_pprobp,
33 void recalc_prob(Sequence sequence, int input_table, int mode,
34 int which_priors, int which_priorp,
35 double prior_freq_single[MAX_TABLE_NUMBER],
36 double prior_freq_pair[MAX_TABLE_NUMBER],
37 int good_turing, int structural_pos[POSNUM+1])
39 void recalc_prob(Sequence sequence, int input_table, int mode)
42 estimate_database_probs(input_table, pfreqs[input_table],
43 ptotals[input_table], many_pprobs,
44 pfreqp[input_table], ptotalp[input_table],
45 many_pprobp, ProlineFreeWindow, which_priors,
46 which_priorp, prior_freq_single[input_table],
47 prior_freq_pair[input_table], good_turing,
50 estimate_database_probs2(input_table, pfreqs[input_table],
51 ptotals[input_table], many_pprobs,
52 pfreqp[input_table], ptotalp[input_table],
53 many_pprobp, ProlineFreeWindow);
61 for (i=0; i<*number_tables; i++)
66 void average_score_over_coils3(Sequence seq,
67 double StructureResLike[MAXSEQLEN][POSNUM+1],
68 double StructureCoilLike[MAXSEQLEN][POSNUM+1],
69 double CoilLike[MAXSEQLEN][POSNUM+1],
70 int weighted_avg, int offset_to_use,
71 char offsets[MAXSEQLEN],
72 int start_at_reg_shift, double bound,
75 void average_score_over_coils3(Sequence seq,
76 double StructureResLike[MAXSEQLEN][POSNUM+1],
77 double StructureCoilLike[MAXSEQLEN][POSNUM+1],
78 double CoilLike[MAXSEQLEN][POSNUM+1],
80 char offsets[MAXSEQLEN],
81 int start_at_reg_shift, double bound,
87 void MultiCoilDimensionScore (int mode, Sequence sequence, char lib[MAXFUNCTNUM], double *maxscore, int table, char offsets[MAXSEQLEN], double scores[MAXSEQLEN][POSNUM+1], int offset_to_use, int pairs)
89 void MultiCoilDimensionScore (int mode, Sequence sequence, char lib[MAXFUNCTNUM], double *maxscore, int table, char offsets[MAXSEQLEN], double scores[MAXSEQLEN][POSNUM+1], int offset_to_use)
95 else if (i > 1) { /* If there are 2 other tables average them. */
96 average_many_pprob(i);
97 combine_many_weight(i);
100 fprintf(stderr, "\nCould not make combination table number %d.",i);
101 fprintf(stderr, "\nAll later tables will be unavailable.\n");
107 fprintf(stderr, "\nCould not make input table number %d.",i);
113 if (*number_tables != i) { /* Just check for above where couldn't */
114 #ifdef AVG_WEIRD_PROBS /* make table. */
115 calc_weird_pprob_avg(many_pprobp[i], many_pprobs[i]);
117 calc_weird_pprob_sum(many_pprobp[i], many_pprobs[i]);
121 #ifdef AVG_WEIRD_PROBS /* make table. */
122 calc_weird_pprob_avg(many_pprobp[i], many_pprobs[i]);
124 calc_weird_pprob_sum(many_pprobp[i], many_pprobs[i]);
129 /*******************************ROUND 2 *****************************/
132 /* #define PAIR_PIR_TXT "/local/bab/pir_pair.txt" */
135 double many_weights[MAX_TABLE_NUMBER][AANUM][POSNUM],
136 many_weightp[MAX_TABLE_NUMBER][AANUM][AANUM][POSNUM][POSNUM];
138 double dist_weight[POSNUM];
139 double prior_probs[NUM_RES_TYPE][POSNUM],
140 prior_probp[NUM_RES_TYPE][NUM_RES_TYPE][POSNUM][POSNUM];
141 double (*weights)[POSNUM];
142 double (*weightp)[AANUM][POSNUM][POSNUM];
148 cut weights= many_weights[table];
149 weightp= many_weightp[table];
153 /* NOTE THAT THE many_pprob variables are globally defined in interface.h. */
154 /** This gives the current_table probabilities the average of tables 1 and 2 */
155 void average_many_pprob(int current_table)
157 int reg1, reg2, res1, res2;
159 for (res1=0; res1<AANUM; res1++)
160 for (reg1=0; reg1<POSNUM; reg1++) {
161 many_pprobs[current_table][res1][reg1] =
162 (many_pprobs[0][res1][reg1] + many_pprobs[1][res1][reg1])/2;
164 for (res2=0; res2<AANUM; res2++)
165 for (reg2=0; reg2<POSNUM; reg2++)
166 many_pprobp[current_table][res1][res2][reg1][reg2] =
167 (many_pprobp[0][res1][res2][reg1][reg2] +
168 many_pprobp[1][res1][res2][reg1][reg2]) /2;
175 else { /* Do weighted paircoil. */
176 calcweight(pfreqs[input_table], pfreqp[input_table],gprobs, gprobp,
177 many_weights[input_table], many_weightp[input_table],
178 ptotals[input_table], ptotalp[input_table],NULL);
180 calc_weighted_pprobs(pfreqs[input_table], ptotals[input_table],
181 many_pprobs[input_table],
182 ProlineFreeWindow, many_weights[input_table],
184 calc_weighted_pprobp(pfreqp[input_table], ptotalp[input_table],
185 many_pprobs[input_table],
186 many_pprobp[input_table], ProlineFreeWindow,
187 many_weightp[input_table],
192 average_many_pprob(2);
193 combine_many_weight(2); /*** Recompute the combination table probs. **/
196 From PairCoilData, cut:
197 FILE *weight_file=NULL;
198 extern char weightfile_outname[MAXLINE];
200 if ((strcmp(weightfile_outname, "/dev/null")) || (mode & WEIGHTED_PROBS))
201 weight_file = sopen(weightfile_outname,"w");
202 if (weight_file) fprintf(weight_file,"\nTable number %d\n",i);
206 if (!(mode & WEIGHTED_PROBS)) {
207 estimate_database_probs(i, pfreqs[i], ptotals[i], many_pprobs,
208 pfreqp[i], ptotalp[i], many_pprobp,
211 calcpprobs(pfreqs[i], ptotals[i], many_pprobs[i], ProlineFree);
212 calcpprobp(pfreqp[i], ptotalp[i], many_pprobs[i], many_pprobp[i],
214 ********************/
216 if (weight_file) printfreq_prob(pfreqs[i],pfreqp[i],
217 weight_file,many_pprobs[i], many_pprobp[i]);
219 else { /* Do weighted paircoil. */
220 double bonnies_pprobs[NUM_RES_TYPE][POSNUM];
221 double bonnies_pprobp[NUM_RES_TYPE][NUM_RES_TYPE][POSNUM][POSNUM];
223 calcweight(pfreqs[i], pfreqp[i],gprobs, gprobp,
224 many_weights[i], many_weightp[i],
225 ptotals[i], ptotalp[i],weight_file);
227 calcpprobs(pfreqs[i], ptotals[i], bonnies_pprobs, ProlineFree);
228 calcpprobp(pfreqp[i], ptotalp[i], bonnies_pprobs, bonnies_pprobp,
231 calc_weighted_pprobs(pfreqs[i], ptotals[i], many_pprobs[i],
232 ProlineFree, many_weights[i], gprobs, NULL);
233 calc_weighted_pprobp(pfreqp[i], ptotalp[i], many_pprobs[i],
234 many_pprobp[i], ProlineFree, many_weightp[i],
237 printweight(pfreqs[i],pfreqp[i],gprobs,gprobp,many_weights[i], many_weightp[i], ptotals[i],ptotalp[i],weight_file, many_pprobs[i], many_pprobp[i],bonnies_pprobs,bonnies_pprobp);
245 estimate_database_probs(i, pfreqs[i], ptotals[i], many_pprobs,
246 pfreqp[i], ptotalp[i], many_pprobp,
251 if (mode & WEIGHTED_PROBS) fclose(weight_file);
252 calc_distance_weights(dist,weight);
256 PairCoilDiffer and average_scores_over_coil2 into file
257 PairCoilDiffer_cuts.c
258 and PairCoilDifferDimension() and zero_out_non_coils() and
259 zero_out_bad_windows( into PairCoilDiffer.c