MCPcopy Create free account
hub / github.com/BirolLab/abyss / estimateDistanceUsingMedian

Function estimateDistanceUsingMedian

DistanceEst/DistanceEst.cpp:187–202  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

185 * @return the estimated distance
186 */
187static 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 */
205unsigned g_recMA;

Callers 1

estimateDistanceFunction · 0.85

Calls 4

minProbabilityMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
medianMethod · 0.45

Tested by

no test coverage detected