Skip to content

Commit 391e939

Browse files
committed
bit-score cleanup
1 parent ea5bb68 commit 391e939

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

src/search_algo.hpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,7 @@ computeBlastMatch(typename TBlastRecord::TBlastMatch & bm,
17361736
computeBitScore(bm, context(lH.gH.outfile));
17371737

17381738
computeEValueThreadSafe(bm, record.qLength, context(lH.gH.outfile));
1739-
if (bm.eValue > lH.options.eCutOff)
1739+
if (bm.eValue > lH.options.maxEValue)
17401740
return EVALUE;
17411741

17421742
_setFrames(bm, m, lH);
@@ -2431,9 +2431,9 @@ iterateMatchesFullSimd(TLocalHolder & lH)
24312431
{
24322432
TBlastMatch & bm = *it;
24332433

2434-
if (lH.options.minBitScore >= 0)
2434+
if (lH.options.minBitScore > 0)
24352435
{
2436-
seqan::computeBitScore(bm, seqan::context(lH.gH.outfileBlastTab));
2436+
seqan::computeBitScore(bm, seqan::context(lH.gH.outfile));
24372437

24382438
if (bm.bitScore < lH.options.minBitScore)
24392439
{
@@ -2443,9 +2443,9 @@ iterateMatchesFullSimd(TLocalHolder & lH)
24432443
}
24442444
}
24452445

2446-
if (lH.options.maxEValue >= 0)
2446+
if (lH.options.maxEValue < 100)
24472447
{
2448-
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfileBlastTab));
2448+
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfile));
24492449

24502450
if (bm.eValue > lH.options.maxEValue)
24512451
{
@@ -2496,11 +2496,11 @@ iterateMatchesFullSimd(TLocalHolder & lH)
24962496
}
24972497

24982498
// not computed previously
2499-
if (lH.options.minBitScore < 0)
2500-
seqan::computeBitScore(bm, seqan::context(lH.gH.outfileBlastTab));
2499+
if (lH.options.minBitScore == 0)
2500+
seqan::computeBitScore(bm, seqan::context(lH.gH.outfile));
25012501

2502-
if (lH.options.maxEValue < 0)
2503-
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfileBlastTab));
2502+
if (lH.options.maxEValue == 100)
2503+
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfile));
25042504

25052505
++it;
25062506
}
@@ -2611,9 +2611,16 @@ iterateMatchesFullSerial(TLocalHolder & lH)
26112611
-band,
26122612
+band);
26132613

2614-
computeEValueThreadSafe(bm, record.qLength, context(lH.gH.outfile));
2614+
computeBitScore(bm, context(lH.gH.outfile));
2615+
if (bm.bitScore < lH.options.minBitScore)
2616+
{
2617+
++lH.stats.hitsFailedExtendBitScoreTest;
2618+
record.matches.pop_back();
2619+
continue;
2620+
}
26152621

2616-
if (bm.eValue > lH.options.eCutOff)
2622+
computeEValueThreadSafe(bm, record.qLength, context(lH.gH.outfile));
2623+
if (bm.eValue > lH.options.maxEValue)
26172624
{
26182625
++lH.stats.hitsFailedExtendEValueTest;
26192626
record.matches.pop_back();
@@ -2638,7 +2645,6 @@ iterateMatchesFullSerial(TLocalHolder & lH)
26382645
continue;
26392646
}
26402647

2641-
computeBitScore(bm, context(lH.gH.outfile));
26422648

26432649
if (lH.options.hasSTaxIds)
26442650
bm.sTaxIds = lH.gH.sTaxIds[bm._n_sId];

src/search_options.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ struct LambdaOptions : public SharedOptions
9595
int misMatch = 0; // only for manual
9696

9797
int xDropOff = 0;
98-
int32_t minBitScore = -1;
98+
int band = -1;
99+
double minBitScore = 0;
99100
double maxEValue = 1e-04;
100101
int idCutOff = 0;
101102
unsigned long maxMatches = 500;
@@ -247,6 +248,14 @@ parseCommandLine(LambdaOptions & options, int argc, char const ** argv)
247248
setMinValue(parser, "e-value", "0");
248249
setMaxValue(parser, "e-value", "100");
249250

251+
addOption(parser, ArgParseOption("", "bit-score",
252+
"Output only matches that score above this threshold.",
253+
ArgParseArgument::DOUBLE));
254+
setDefaultValue(parser, "bit-score", "0");
255+
setMinValue(parser, "bit-score", "0");
256+
setMaxValue(parser, "bit-score", "1000");
257+
258+
250259
addOption(parser, ArgParseOption("n", "num-matches",
251260
"Print at most this number of matches per query.",
252261
ArgParseArgument::INTEGER));
@@ -771,7 +780,8 @@ parseCommandLine(LambdaOptions & options, int argc, char const ** argv)
771780

772781
getOptionValue(options.seedDeltaIncreasesLength, parser, "seed-delta-increases-length");
773782

774-
getOptionValue(options.eCutOff, parser, "e-value");
783+
getOptionValue(options.maxEValue, parser, "e-value");
784+
getOptionValue(options.minBitScore, parser, "bit-score");
775785
getOptionValue(options.idCutOff, parser, "percent-identity");
776786

777787
getOptionValue(options.xDropOff, parser, "x-drop");

0 commit comments

Comments
 (0)