Skip to content

Commit fea8d20

Browse files
Add support for external k-mer thresholds for the prefilter
1 parent ede0be1 commit fea8d20

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/mmseqs.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Command.h"
22
#include "DownloadDatabase.h"
3+
#include "Prefiltering.h"
34

45
const char* binary_name = "mmseqs";
56
const char* tool_name = "MMseqs2";
@@ -13,5 +14,6 @@ bool hide_base_commands = false;
1314
void (*validatorUpdate)(void) = 0;
1415
std::vector<Command> commands = {};
1516
std::vector<DatabaseDownload> externalDownloads = {};
17+
std::vector<KmerThreshold> externalThreshold = {};
1618

17-
bool hide_base_downloads = false;
19+
bool hide_base_downloads = false;

src/prefiltering/Prefiltering.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,12 @@ int Prefiltering::getKmerThreshold(const float sensitivity, const bool isProfile
10081008
return kmerScore.sequence();
10091009
}
10101010
float kmerThrBest = FLT_MAX;
1011+
int paramType = isProfile ? Parameters::DBTYPE_HMM_PROFILE : Parameters::DBTYPE_AMINO_ACIDS;
1012+
for(size_t i = 0; i < externalThreshold.size(); i++){
1013+
if(kmerSize == externalThreshold[i].kmerSize && externalThreshold[i].sequenceType == paramType){
1014+
return static_cast<int>(externalThreshold[i].base - (externalThreshold[i].sensPerStep * sensitivity));
1015+
}
1016+
}
10111017
if (isProfile == true) {
10121018
if (hasContextPseudoCnts == true) {
10131019
if (kmerSize == 5) {
@@ -1131,3 +1137,4 @@ std::pair<int, int> Prefiltering::optimizeSplit(size_t totalMemoryInByte, DBRead
11311137
}
11321138

11331139

1140+

src/prefiltering/Prefiltering.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515

1616
class QueryMatcherTaxonomyHook;
1717

18+
struct KmerThreshold{
19+
int sequenceType;
20+
int kmerSize;
21+
float base;
22+
float sensPerStep;
23+
};
24+
25+
extern std::vector<KmerThreshold> externalThreshold;
26+
27+
1828
class Prefiltering {
1929
public:
2030
Prefiltering(
@@ -130,3 +140,4 @@ class Prefiltering {
130140
};
131141

132142
#endif
143+

0 commit comments

Comments
 (0)