| 367 | } |
| 368 | |
| 369 | static Support |
| 370 | testCombination( |
| 371 | const std::string& head, |
| 372 | const std::string& repeat, |
| 373 | const std::string& tail, |
| 374 | const int requestedTests) |
| 375 | { |
| 376 | const auto windowSize = g_vanillaBloom->get_k(); |
| 377 | |
| 378 | auto plannedTests = requestedTests; |
| 379 | if (plannedTests < opt::minTests) { |
| 380 | plannedTests = opt::minTests; |
| 381 | } |
| 382 | |
| 383 | int possibleTests = head.size() + repeat.size() + tail.size() - windowSize + 1; |
| 384 | if (possibleTests < plannedTests) { |
| 385 | return Support(Support::UnknownReason::POSSIBLE_TESTS_LT_PLANNED); |
| 386 | } |
| 387 | |
| 388 | if (plannedTests > opt::maxTests) { |
| 389 | return Support(Support::UnknownReason::OVER_MAX_TESTS); |
| 390 | } |
| 391 | |
| 392 | const auto margin = getMargin(windowSize, plannedTests, repeat.size(), MIN_MARGIN); |
| 393 | |
| 394 | if (long(head.size()) < margin) { |
| 395 | return Support(Support::UnknownReason::HEAD_SHORTER_THAN_MARGIN); |
| 396 | } |
| 397 | |
| 398 | if (long(tail.size()) < margin) { |
| 399 | return Support(Support::UnknownReason::TAIL_SHORTER_THAN_MARGIN); |
| 400 | } |
| 401 | |
| 402 | Sequence sequence; |
| 403 | if (possibleTests > plannedTests + 1) { |
| 404 | assert(long(head.size()) > margin || long(tail.size()) > margin); |
| 405 | sequence = head.substr(head.size() - margin) + repeat + tail.substr(0, margin); |
| 406 | } else { |
| 407 | sequence = head + repeat + tail; |
| 408 | } |
| 409 | possibleTests = sequence.size() - windowSize + 1; |
| 410 | |
| 411 | assert(plannedTests <= possibleTests); |
| 412 | assert(possibleTests <= plannedTests + 1); |
| 413 | assert(int(sequence.size()) >= MIN_MARGIN + int(repeat.size()) + MIN_MARGIN); |
| 414 | assert(int(sequence.size()) < int(windowSize) * 2); |
| 415 | |
| 416 | return testSequence(sequence); |
| 417 | } |
| 418 | |
| 419 | static double |
| 420 | expectedSpacingBetweenReads(const ContigPath& path) |
no test coverage detected