From 05f2749cda4f219e673144887aaa9c61a444e5a2 Mon Sep 17 00:00:00 2001 From: schutzekatze Date: Mon, 8 Mar 2021 18:24:32 -0800 Subject: [PATCH] Make max tests a param --- RResolver/RAlgorithmsShort.cpp | 4 ++-- RResolver/RAlgorithmsShort.h | 4 +++- RResolver/RResolverShort.cpp | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/RResolver/RAlgorithmsShort.cpp b/RResolver/RAlgorithmsShort.cpp index 30edd2ea2..d63caa138 100644 --- a/RResolver/RAlgorithmsShort.cpp +++ b/RResolver/RAlgorithmsShort.cpp @@ -320,7 +320,7 @@ testCombination( return Support(Support::UnknownReason::POSSIBLE_TESTS_LT_PLANNED); } - if (plannedTests > opt::minTests + MAX_TESTS_OFFSET) { + if (plannedTests > opt::maxTests) { return Support(Support::UnknownReason::OVER_MAX_TESTS); } @@ -391,7 +391,7 @@ determinePathSupport(const ContigPath& path) if (requiredTests < opt::minTests) { requiredTests = opt::minTests; } - if (requiredTests > opt::minTests + MAX_TESTS_OFFSET) { + if (requiredTests > opt::maxTests) { return Support(calculatedTests, Support::UnknownReason::OVER_MAX_TESTS); } diff --git a/RResolver/RAlgorithmsShort.h b/RResolver/RAlgorithmsShort.h index 326647026..b3343c2fb 100644 --- a/RResolver/RAlgorithmsShort.h +++ b/RResolver/RAlgorithmsShort.h @@ -14,7 +14,6 @@ #include const int MIN_MARGIN = 2; -const int MAX_TESTS_OFFSET = 16; // std::numeric_limits::max(); const int R_HEURISTIC = 45; const double R_HEURISTIC_A = 0.49; const double R_HEURISTIC_B = 63.5; @@ -55,6 +54,9 @@ extern int extract; /** Minimum number of sliding window moves */ extern int minTests; +/** Maximum number of sliding window moves */ +extern int maxTests; + /** Maximum number of branching paths */ extern int branching; diff --git a/RResolver/RResolverShort.cpp b/RResolver/RResolverShort.cpp index 4195a296d..3eaee3ce3 100644 --- a/RResolver/RResolverShort.cpp +++ b/RResolver/RResolverShort.cpp @@ -48,7 +48,8 @@ static const char USAGE_MESSAGE[] = " Histograms are omitted if no prefix is given." " -t, --threshold=N set path support threshold to N. [4]" " -x, --extract=N extract N rmers per read. [4]" - " -m, --min-tests=N set minimum number of sliding window moves to N. Maximum value is 127. [20]" + " -m, --min-tests=N set minimum number of sliding window moves to N. Cannot be higher than 127. [20]" + " -M, --max-tests=N set maximum number of sliding window moves to N. Cannot be higher than 127. [36]" " -n, --branching=N set maximum number of branching paths to N. [75]" " -r, --rmer=N explicitly set r value (k value used by rresolver)." " The number of set r values should be equalto the number of read sizes." @@ -97,6 +98,9 @@ int extract = 4; /** Minimum number of sliding window moves */ int minTests = 20; +/** Maximum number of sliding window moves */ +int maxTests = 36; + /** Maximum number of branching paths */ int branching = 75; @@ -121,7 +125,7 @@ int format; // used by ContigProperties } -static const char shortopts[] = "b:j:g:c:k:h:t:x:m:n:r:q:eS:U:v"; +static const char shortopts[] = "b:j:g:c:k:h:t:x:m:M:n:r:q:eS:U:v"; enum { @@ -139,6 +143,7 @@ static const struct option longopts[] = { { "threshold", required_argument, NULL, 't' }, { "extract", required_argument, NULL, 'x' }, { "min-tests", required_argument, NULL, 'm' }, + { "max-tests", required_argument, NULL, 'M' }, { "branching", required_argument, NULL, 'n' }, { "rmer", required_argument, NULL, 'r' }, { "quality-threshold", required_argument, NULL, 'q' }, @@ -196,6 +201,11 @@ check_options(int argc, bool& die) std::cerr << PROGRAM ": invalid number of threads `-j`" << std::endl; die = true; } + + if (opt::minTests > opt::maxTests) { + std::cerr << PROGRAM ": --min-tests cannot be higher than --max-tests" << std::endl; + die = true; + } } void @@ -296,6 +306,9 @@ main(int argc, char** argv) case 'm': arg >> opt::minTests; break; + case 'M': + arg >> opt::maxTests; + break; case 'n': arg >> opt::branching; break;