Skip to content

Commit

Permalink
Make max tests a param
Browse files Browse the repository at this point in the history
  • Loading branch information
schutzekatze committed Mar 9, 2021
1 parent 1b5ae82 commit 05f2749
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions RResolver/RAlgorithmsShort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion RResolver/RAlgorithmsShort.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <vector>

const int MIN_MARGIN = 2;
const int MAX_TESTS_OFFSET = 16; // std::numeric_limits<int>::max();
const int R_HEURISTIC = 45;
const double R_HEURISTIC_A = 0.49;
const double R_HEURISTIC_B = 63.5;
Expand Down Expand Up @@ -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;

Expand Down
17 changes: 15 additions & 2 deletions RResolver/RResolverShort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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;

Expand All @@ -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
{
Expand All @@ -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' },
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 05f2749

Please sign in to comment.