Estimate the distance between two contigs using the difference of * the population median and the sample median. * @param numPairs [out] the number of pairs that agree with the * expected distribution * @return the estimated distance */
| 185 | * @return the estimated distance |
| 186 | */ |
| 187 | static int estimateDistanceUsingMedian( |
| 188 | const std::vector<int>& samples, const PMF& pmf, |
| 189 | unsigned& numPairs) |
| 190 | { |
| 191 | Histogram h(samples.begin(), samples.end()); |
| 192 | int d = (int)round(pmf.median() - h.median()); |
| 193 | // Count the number of samples that agree with the distribution. |
| 194 | unsigned n = 0; |
| 195 | for (Histogram::const_iterator it = h.begin(); |
| 196 | it != h.end(); ++it) |
| 197 | if (pmf[it->first + d] > pmf.minProbability()) |
| 198 | n += it->second; |
| 199 | |
| 200 | numPairs = n; |
| 201 | return d; |
| 202 | } |
| 203 | |
| 204 | /** Global variable to track a recommended minAlign parameter */ |
| 205 | unsigned g_recMA; |
no test coverage detected