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

Function expectedSpacingBetweenReads

RResolver/RAlgorithmsShort.cpp:419–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419static double
420expectedSpacingBetweenReads(const ContigPath& path)
421{
422 assert(path.size() >= 3);
423 const long pathLength = 1000000; // Use long path lenth in order to calculate numbers asymptotically
424 std::vector<double> contigBaseCoverages;
425 for (const auto& node : path) {
426 contigBaseCoverages.push_back(getContigBaseCoverage(node));
427 }
428 const double pathBaseCoverage = *std::min_element(contigBaseCoverages.begin(), contigBaseCoverages.end());
429 const double pathBases = pathBaseCoverage * pathLength;
430
431 double meanReadKmerContribution = 0;
432 for (const auto& batch : ReadSize::readSizes) {
433 meanReadKmerContribution += batch.getFractionOfTotal() * (batch.size - opt::k + 1);
434 }
435 const double baseContributionRatio = ReadSize::current.getFractionOfTotal() *
436 (ReadSize::current.size - opt::k + 1) /
437 meanReadKmerContribution;
438
439 const double approxNumOfReads = double(pathBases * baseContributionRatio) /
440 double(opt::k * (ReadSize::current.size - opt::k + 1));
441 assert(approxNumOfReads > 2);
442
443 const double expectedSpacing = std::max(double(1.0), double(pathLength - ReadSize::current.size + 1) / double(approxNumOfReads));
444
445 return expectedSpacing;
446}
447
448static Support
449determinePathSupport(const ContigPath& path)

Callers 1

Calls 6

getContigBaseCoverageFunction · 0.85
getFractionOfTotalMethod · 0.80
sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected