Skip to content

Commit ea5bb68

Browse files
committed
[feature] minimum bit-score
1 parent fc636ea commit ea5bb68

3 files changed

Lines changed: 38 additions & 17 deletions

File tree

src/search_algo.hpp

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,17 +2431,28 @@ iterateMatchesFullSimd(TLocalHolder & lH)
24312431
{
24322432
TBlastMatch & bm = *it;
24332433

2434-
computeEValueThreadSafe(bm,
2435-
qIsTranslated(TGlobalHolder::blastProgram)
2436-
? lH.gH.untransQrySeqLengths[bm._n_qId]
2437-
: length(lH.gH.qrySeqs[_untrueQryId(bm, lH)]),
2438-
context(lH.gH.outfile));
2434+
if (lH.options.minBitScore >= 0)
2435+
{
2436+
seqan::computeBitScore(bm, seqan::context(lH.gH.outfileBlastTab));
24392437

2440-
if (bm.eValue > lH.options.eCutOff)
2438+
if (bm.bitScore < lH.options.minBitScore)
2439+
{
2440+
++lH.stats.hitsFailedExtendBitScoreTest;
2441+
it = blastMatches.erase(it);
2442+
continue;
2443+
}
2444+
}
2445+
2446+
if (lH.options.maxEValue >= 0)
24412447
{
2442-
++lH.stats.hitsFailedExtendEValueTest;
2443-
it = blastMatches.erase(it);
2444-
continue;
2448+
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfileBlastTab));
2449+
2450+
if (bm.eValue > lH.options.maxEValue)
2451+
{
2452+
++lH.stats.hitsFailedExtendEValueTest;
2453+
it = blastMatches.erase(it);
2454+
continue;
2455+
}
24452456
}
24462457

24472458
++it;
@@ -2484,9 +2495,12 @@ iterateMatchesFullSimd(TLocalHolder & lH)
24842495
continue;
24852496
}
24862497

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

2489-
// evalue computed previously
2502+
if (lH.options.maxEValue < 0)
2503+
computeEValueThreadSafe(bm, bm.qLength, seqan::context(lH.gH.outfileBlastTab));
24902504

24912505
++it;
24922506
}

src/search_datastructures.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ struct StatsHolder
111111

112112
// post-extension
113113
uint64_t hitsFailedExtendPercentIdentTest;
114+
uint64_t hitsFailedExtendBitScoreTest;
114115
uint64_t hitsFailedExtendEValueTest;
115116
uint64_t hitsAbundant;
116117
uint64_t hitsDuplicate;
@@ -150,6 +151,7 @@ struct StatsHolder
150151
hitsPutativeAbundant = 0;
151152

152153
hitsFailedExtendPercentIdentTest = 0;
154+
hitsFailedExtendBitScoreTest = 0;
153155
hitsFailedExtendEValueTest = 0;
154156
hitsAbundant = 0;
155157
hitsDuplicate = 0;
@@ -183,6 +185,7 @@ struct StatsHolder
183185
hitsPutativeAbundant += rhs.hitsPutativeAbundant;
184186

185187
hitsFailedExtendPercentIdentTest += rhs.hitsFailedExtendPercentIdentTest;
188+
hitsFailedExtendBitScoreTest += rhs.hitsFailedExtendBitScoreTest;
186189
hitsFailedExtendEValueTest += rhs.hitsFailedExtendEValueTest;
187190
hitsAbundant += rhs.hitsAbundant;
188191
hitsDuplicate += rhs.hitsDuplicate;
@@ -253,12 +256,15 @@ void printStats(StatsHolder const & stats, LambdaOptions const & options)
253256
std::cout << "\n - failed pre-extend test " << R
254257
<< stats.hitsFailedPreExtendTest << RR
255258
<< (rem -= stats.hitsFailedPreExtendTest);
256-
std::cout << "\n - failed %-identity test " << R
257-
<< stats.hitsFailedExtendPercentIdentTest << RR
258-
<< (rem -= stats.hitsFailedExtendPercentIdentTest);
259259
std::cout << "\n - failed e-value test " << R
260260
<< stats.hitsFailedExtendEValueTest << RR
261261
<< (rem -= stats.hitsFailedExtendEValueTest);
262+
std::cout << "\n - failed bitScore test " << R
263+
<< stats.hitsFailedExtendBitScoreTest << RR
264+
<< (rem -= stats.hitsFailedExtendBitScoreTest);
265+
std::cout << "\n - failed %-identity test " << R
266+
<< stats.hitsFailedExtendPercentIdentTest << RR
267+
<< (rem -= stats.hitsFailedExtendPercentIdentTest);
262268
std::cout << "\n - duplicates " << R
263269
<< stats.hitsDuplicate << RR
264270
<< (rem -= stats.hitsDuplicate);

src/search_options.hpp

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

9797
int xDropOff = 0;
98-
int band = -1;
99-
double eCutOff = 0;
98+
int32_t minBitScore = -1;
99+
double maxEValue = 1e-04;
100100
int idCutOff = 0;
101101
unsigned long maxMatches = 500;
102102

@@ -903,8 +903,9 @@ printOptions(LambdaOptions const & options)
903903
<< " db index type: " << _indexEnumToName(options.dbIndexType) << "\n"
904904
<< " OUTPUT (file)\n"
905905
<< " output file: " << options.output << "\n"
906+
<< " maximum e-value: " << options.maxEValue << "\n"
907+
<< " minimum bit-score: " << options.minBitScore << "\n"
906908
<< " minimum % identity: " << options.idCutOff << "\n"
907-
<< " maximum e-value: " << options.eCutOff << "\n"
908909
<< " max #matches per query: " << options.maxMatches << "\n"
909910
<< " include subj names in sam:" << options.samWithRefHeader << "\n"
910911
<< " include seq in sam/bam: " << options.samBamSeq << "\n"

0 commit comments

Comments
 (0)