42 template <
typename ScoringSchemeType>
57 const uint32 o_read_len)
const
60 const int unpaired_one_perfect = 44;
63 const int unpaired_one[11] =
65 43, 42, 41, 36, 32, 27, 20, 11, 4, 1, 0
69 const int unpaired_two_perfect[11] =
71 2, 16, 23, 30, 31, 32, 34, 36, 38, 40, 42
75 const int unpaired_two[11][11] =
77 { 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0 },
78 { 20, 14, 7, 3, 2, 1, 0, 0, 0, 0, 0 },
79 { 20, 16, 10, 6, 3, 1, 0, 0, 0, 0, 0 },
80 { 20, 17, 13, 9, 3, 1, 1, 0, 0, 0, 0 },
81 { 21, 19, 15, 9, 5, 2, 2, 0, 0, 0, 0 },
82 { 22, 21, 16, 11, 10, 5, 0, 0, 0, 0, 0 },
83 { 23, 22, 19, 16, 11, 0, 0, 0, 0, 0, 0 },
84 { 24, 25, 21, 30, 0, 0, 0, 0, 0, 0, 0 },
85 { 30, 26, 29, 0, 0, 0, 0, 0, 0, 0, 0 },
86 { 30, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
87 { 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
91 const int paired_one_perfect = 44;
97 return paired_one_perfect;
99 const float max_score = (float)m_sc.perfect_score( read_len );
100 const float min_score = (float)m_sc.min_score( read_len );
101 const float norm_factor = 10.0f / (max_score - min_score);
108 const int best_bin = (int)(
float(best) * norm_factor + 0.5f);
110 const bool has_second = best_alignments.
has_second();
122 const int diff_bin = (int)(
float(diff) * norm_factor + 0.5f);
124 if (best == max_score)
125 return unpaired_two_perfect[best_bin];
127 return unpaired_two[diff_bin][best_bin];
131 if (best == max_score)
132 return unpaired_one_perfect;
134 return unpaired_one[best_bin];
139 ScoringSchemeType m_sc;
144 template <
typename ScoringSchemeType>
159 const uint32 o_read_len)
const
161 bool has_second = best_alignments.
has_second();
163 const float max_score = (float)m_sc.perfect_score( read_len ) +
164 (best_alignments.
is_paired() ? m_sc.perfect_score( o_read_len ) : 0);
165 const float min_score = (float)m_sc.min_score( read_len ) +
166 (best_alignments.
is_paired() ? m_sc.min_score( o_read_len ) : 0);
168 const float diff = (max_score - min_score);
170 const float best = (float)best_alignments.
best_score();
171 float second_best = min_score-1;
173 if (best < min_score)
177 const float best_over = best - min_score;
190 if (best_over >= diff * 0.8f)
return 42;
191 else if (best_over >= diff * 0.7f)
return 40;
192 else if (best_over >= diff * 0.6f)
return 24;
193 else if (best_over >= diff * 0.5f)
return 23;
194 else if (best_over >= diff * 0.4f)
return 8;
195 else if (best_over >= diff * 0.3f)
return 3;
204 const float best_diff = fabsf(fabsf( best ) - fabsf( second_best ));
206 if (best_diff >= diff * 0.9f)
207 return (best_over == diff) ? 39 : 33;
208 else if (best_diff >= diff * 0.8f)
209 return (best_over == diff) ? 38 : 27;
210 else if (best_diff >= diff * 0.7f)
211 return (best_over == diff) ? 37 : 26;
212 else if (best_diff >= diff * 0.6f)
213 return (best_over == diff) ? 36 : 22;
214 else if (best_diff >= diff * 0.5f)
217 if (best_over == diff)
return 35;
218 else if (best_over >= diff * 0.84f)
return 25;
219 else if (best_over >= diff * 0.68f)
return 16;
222 else if (best_diff >= diff * 0.4f)
225 if (best_over == diff)
return 34;
226 else if (best_over >= diff * 0.84f)
return 21;
227 else if (best_over >= diff * 0.68f)
return 14;
230 else if (best_diff >= diff * 0.3f)
233 if (best_over == diff)
return 32;
234 else if (best_over >= diff * 0.88f)
return 18;
235 else if (best_over >= diff * 0.67f)
return 15;
238 else if (best_diff >= diff * 0.2f)
241 if (best_over == diff)
return 31;
242 else if (best_over >= diff * 0.88f)
return 17;
243 else if (best_over >= diff * 0.67f)
return 11;
246 else if (best_diff >= diff * 0.1f)
249 if (best_over == diff)
return 30;
250 else if (best_over >= diff * 0.88f)
return 12;
251 else if (best_over >= diff * 0.67f)
return 7;
254 else if (best_diff > 0)
257 return (best_over >= diff * 0.67f) ? 6 : 2;
262 return (best_over >= diff * 0.67f) ? 1 : 0;
271 if (best_over >= diff * 0.8f)
return 44;
272 else if (best_over >= diff * 0.7f)
return 42;
273 else if (best_over >= diff * 0.6f)
return 41;
274 else if (best_over >= diff * 0.5f)
return 36;
275 else if (best_over >= diff * 0.4f)
return 28;
276 else if (best_over >= diff * 0.3f)
return 24;
285 const float best_diff = fabsf(fabsf( best ) - fabsf( second_best ));
287 if (best_diff >= diff * 0.9f)
return 40;
288 else if (best_diff >= diff * 0.8f)
return 39;
289 else if (best_diff >= diff * 0.7f)
return 38;
290 else if (best_diff >= diff * 0.6f)
return 37;
291 else if (best_diff >= diff * 0.5f)
293 if (best_over == diff)
return 35;
294 else if (best_over >= diff * 0.50f)
return 25;
297 else if (best_diff >= diff * 0.4f)
299 if (best_over == diff)
return 34;
300 else if (best_over >= diff * 0.50f)
return 21;
303 else if (best_diff >= diff * 0.3f)
305 if (best_over == diff)
return 33;
306 else if (best_over >= diff * 0.5f)
return 18;
309 else if (best_diff >= diff * 0.2f)
311 if (best_over == diff)
return 32;
312 else if (best_over >= diff * 0.5f)
return 17;
315 else if (best_diff >= diff * 0.1f)
317 if (best_over == diff)
return 31;
318 else if (best_over >= diff * 0.5f)
return 14;
321 else if (best_diff > 0)
322 return (best_over >= diff * 0.5f) ? 11 : 2;
324 return (best_over >= diff * 0.5f) ? 1 : 0;
330 ScoringSchemeType m_sc;