Skip to content

Commit 05f2749

Browse files
author
schutzekatze
committed
Make max tests a param
1 parent 1b5ae82 commit 05f2749

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

RResolver/RAlgorithmsShort.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ testCombination(
320320
return Support(Support::UnknownReason::POSSIBLE_TESTS_LT_PLANNED);
321321
}
322322

323-
if (plannedTests > opt::minTests + MAX_TESTS_OFFSET) {
323+
if (plannedTests > opt::maxTests) {
324324
return Support(Support::UnknownReason::OVER_MAX_TESTS);
325325
}
326326

@@ -391,7 +391,7 @@ determinePathSupport(const ContigPath& path)
391391
if (requiredTests < opt::minTests) {
392392
requiredTests = opt::minTests;
393393
}
394-
if (requiredTests > opt::minTests + MAX_TESTS_OFFSET) {
394+
if (requiredTests > opt::maxTests) {
395395
return Support(calculatedTests, Support::UnknownReason::OVER_MAX_TESTS);
396396
}
397397

RResolver/RAlgorithmsShort.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <vector>
1515

1616
const int MIN_MARGIN = 2;
17-
const int MAX_TESTS_OFFSET = 16; // std::numeric_limits<int>::max();
1817
const int R_HEURISTIC = 45;
1918
const double R_HEURISTIC_A = 0.49;
2019
const double R_HEURISTIC_B = 63.5;
@@ -55,6 +54,9 @@ extern int extract;
5554
/** Minimum number of sliding window moves */
5655
extern int minTests;
5756

57+
/** Maximum number of sliding window moves */
58+
extern int maxTests;
59+
5860
/** Maximum number of branching paths */
5961
extern int branching;
6062

RResolver/RResolverShort.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ static const char USAGE_MESSAGE[] =
4848
" Histograms are omitted if no prefix is given."
4949
" -t, --threshold=N set path support threshold to N. [4]"
5050
" -x, --extract=N extract N rmers per read. [4]"
51-
" -m, --min-tests=N set minimum number of sliding window moves to N. Maximum value is 127. [20]"
51+
" -m, --min-tests=N set minimum number of sliding window moves to N. Cannot be higher than 127. [20]"
52+
" -M, --max-tests=N set maximum number of sliding window moves to N. Cannot be higher than 127. [36]"
5253
" -n, --branching=N set maximum number of branching paths to N. [75]"
5354
" -r, --rmer=N explicitly set r value (k value used by rresolver)."
5455
" The number of set r values should be equalto the number of read sizes."
@@ -97,6 +98,9 @@ int extract = 4;
9798
/** Minimum number of sliding window moves */
9899
int minTests = 20;
99100

101+
/** Maximum number of sliding window moves */
102+
int maxTests = 36;
103+
100104
/** Maximum number of branching paths */
101105
int branching = 75;
102106

@@ -121,7 +125,7 @@ int format; // used by ContigProperties
121125

122126
}
123127

124-
static const char shortopts[] = "b:j:g:c:k:h:t:x:m:n:r:q:eS:U:v";
128+
static const char shortopts[] = "b:j:g:c:k:h:t:x:m:M:n:r:q:eS:U:v";
125129

126130
enum
127131
{
@@ -139,6 +143,7 @@ static const struct option longopts[] = {
139143
{ "threshold", required_argument, NULL, 't' },
140144
{ "extract", required_argument, NULL, 'x' },
141145
{ "min-tests", required_argument, NULL, 'm' },
146+
{ "max-tests", required_argument, NULL, 'M' },
142147
{ "branching", required_argument, NULL, 'n' },
143148
{ "rmer", required_argument, NULL, 'r' },
144149
{ "quality-threshold", required_argument, NULL, 'q' },
@@ -196,6 +201,11 @@ check_options(int argc, bool& die)
196201
std::cerr << PROGRAM ": invalid number of threads `-j`" << std::endl;
197202
die = true;
198203
}
204+
205+
if (opt::minTests > opt::maxTests) {
206+
std::cerr << PROGRAM ": --min-tests cannot be higher than --max-tests" << std::endl;
207+
die = true;
208+
}
199209
}
200210

201211
void
@@ -296,6 +306,9 @@ main(int argc, char** argv)
296306
case 'm':
297307
arg >> opt::minTests;
298308
break;
309+
case 'M':
310+
arg >> opt::maxTests;
311+
break;
299312
case 'n':
300313
arg >> opt::branching;
301314
break;

0 commit comments

Comments
 (0)