| 417 | } |
| 418 | |
| 419 | static double |
| 420 | expectedSpacingBetweenReads(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 | |
| 448 | static Support |
| 449 | determinePathSupport(const ContigPath& path) |
no test coverage detected