diff --git a/RResolver/RAlgorithmsShort.h b/RResolver/RAlgorithmsShort.h index 51ae41f0e..326647026 100644 --- a/RResolver/RAlgorithmsShort.h +++ b/RResolver/RAlgorithmsShort.h @@ -83,7 +83,7 @@ class Support { public: - enum class UnknownReason : unsigned { + enum class UnknownReason : uint8_t { UNDETERMINED = 0, // Not yet processed TOO_MANY_COMBINATIONS, // Branching out exploded beyond a threshold OVER_MAX_TESTS, // Planned tests was above the threshold @@ -102,13 +102,15 @@ class Support Support(int calculatedTests, UnknownReason unknownReason) : found(-1) , tests(-1) - , calculatedTests(calculatedTests) , unknownReason(unknownReason) { assert(calculatedTests >= 0); + if (calculatedTests > std::numeric_limitscalculatedTests)>::max()) { this->calculatedTests = std::numeric_limitscalculatedTests)>::max(); } else { + this->calculatedTests = calculatedTests; + } } - Support(int found, int tests) + Support(int8_t found, int8_t tests) : found(found) , tests(tests) { @@ -117,14 +119,16 @@ class Support assert(calculatedTests == -1); } - Support(int found, int tests, int calculatedTests) + Support(int8_t found, int8_t tests, int calculatedTests) : found(found) , tests(tests) - , calculatedTests(calculatedTests) { assert(found >= 0); assert(tests > 0); assert(calculatedTests >= 0); + if (calculatedTests > std::numeric_limitscalculatedTests)>::max()) { this->calculatedTests = std::numeric_limitscalculatedTests)>::max(); } else { + this->calculatedTests = calculatedTests; + } } bool unknown() const { return tests == -1; } @@ -141,9 +145,9 @@ class Support bool operator<(const Support& s) { return found < s.found; } - int found = -1; - int tests = -1; - int calculatedTests = -1; + int8_t found = -1; + int8_t tests = -1; + int8_t calculatedTests = -1; UnknownReason unknownReason = UnknownReason::UNDETERMINED; }; diff --git a/RResolver/RResolverShort.cpp b/RResolver/RResolverShort.cpp index 418fa7823..4195a296d 100644 --- a/RResolver/RResolverShort.cpp +++ b/RResolver/RResolverShort.cpp @@ -48,7 +48,7 @@ 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. [20]" + " -m, --min-tests=N set minimum number of sliding window moves to N. Maximum value is 127. [20]" " -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."