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

Function writeEstimates

DistanceEst/DistanceEst.cpp:338–377  ·  view source on GitHub ↗

Generate distance estimates for the specified alignments. */

Source from the content-addressed store, hash-verified

336
337/** Generate distance estimates for the specified alignments. */
338static void writeEstimates(ostream& out,
339 const vector<SAMRecord>& pairs,
340 const vector<unsigned>& lengthVec, const PMF& pmf)
341{
342 assert(!pairs.empty());
343 ContigID id0(get(g_contigNames, pairs.front().rname));
344 assert(id0 < lengthVec.size());
345 unsigned len0 = lengthVec[id0];
346 if (len0 < opt::seedLen)
347 return; // Skip contigs shorter than the seed length.
348
349 ostringstream ss;
350 if (opt::format == DIST)
351 ss << pairs.front().rname;
352
353 typedef map<ContigNode, Pairs> PairsMap;
354 PairsMap dataMap[2];
355 for (Pairs::const_iterator it = pairs.begin();
356 it != pairs.end(); ++it)
357 dataMap[it->isReverse()][find_vertex(
358 it->mrnm, it->isReverse() == it->isMateReverse(),
359 g_contigNames)]
360 .push_back(*it);
361
362 for (int sense0 = false; sense0 <= true; sense0++) {
363 if (opt::format == DIST && sense0)
364 ss << " ;";
365 const PairsMap& x = dataMap[sense0 ^ opt::rf];
366 for (PairsMap::const_iterator it = x.begin();
367 it != x.end(); ++it)
368 writeEstimate(opt::format == DIST ? ss : out,
369 ContigNode(id0, sense0), it->first,
370 len0, lengthVec[it->first.id()],
371 it->second, pmf);
372 }
373 if (opt::format == DIST)
374#pragma omp critical(out)
375 out << ss.str() << '\n';
376 assert(out.good());
377}
378
379/** Load a histogram from the specified file. */
380static Histogram loadHist(const string& path)

Callers 1

mainFunction · 0.85

Calls 15

writeEstimateFunction · 0.85
ContigNodeClass · 0.85
isReverseMethod · 0.80
isMateReverseMethod · 0.80
idMethod · 0.80
goodMethod · 0.80
getFunction · 0.50
find_vertexFunction · 0.50
emptyMethod · 0.45
frontMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected