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

Function estimateDistanceUsingMean

DistanceEst/DistanceEst.cpp:163–179  ·  view source on GitHub ↗

Estimate the distance between two contigs using the difference of * the population mean and the sample mean. * @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

161 * @return the estimated distance
162 */
163static int estimateDistanceUsingMean(
164 const std::vector<int>& samples, const PMF& pmf,
165 unsigned& numPairs)
166{
167 Histogram h(samples.begin(), samples.end());
168 int d = (int)round(pmf.mean() - h.mean());
169
170 // Count the number of samples that agree with the distribution.
171 unsigned n = 0;
172 for (Histogram::const_iterator it = h.begin();
173 it != h.end(); ++it)
174 if (pmf[it->first + d] > pmf.minProbability())
175 n += it->second;
176
177 numPairs = n;
178 return d;
179}
180
181/** Estimate the distance between two contigs using the difference of
182 * the population median and the sample median.

Callers 1

estimateDistanceFunction · 0.85

Calls 4

minProbabilityMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected