Skip to content

Commit

Permalink
Add support for external k-mer thresholds for the prefilter
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Sep 19, 2022
1 parent ede0be1 commit fea8d20
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mmseqs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Command.h"
#include "DownloadDatabase.h"
#include "Prefiltering.h"

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

bool hide_base_downloads = false;
bool hide_base_downloads = false;
7 changes: 7 additions & 0 deletions src/prefiltering/Prefiltering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,12 @@ int Prefiltering::getKmerThreshold(const float sensitivity, const bool isProfile
return kmerScore.sequence();
}
float kmerThrBest = FLT_MAX;
int paramType = isProfile ? Parameters::DBTYPE_HMM_PROFILE : Parameters::DBTYPE_AMINO_ACIDS;
for(size_t i = 0; i < externalThreshold.size(); i++){
if(kmerSize == externalThreshold[i].kmerSize && externalThreshold[i].sequenceType == paramType){
return static_cast<int>(externalThreshold[i].base - (externalThreshold[i].sensPerStep * sensitivity));
}
}
if (isProfile == true) {
if (hasContextPseudoCnts == true) {
if (kmerSize == 5) {
Expand Down Expand Up @@ -1131,3 +1137,4 @@ std::pair<int, int> Prefiltering::optimizeSplit(size_t totalMemoryInByte, DBRead
}



11 changes: 11 additions & 0 deletions src/prefiltering/Prefiltering.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@

class QueryMatcherTaxonomyHook;

struct KmerThreshold{
int sequenceType;
int kmerSize;
float base;
float sensPerStep;
};

extern std::vector<KmerThreshold> externalThreshold;


class Prefiltering {
public:
Prefiltering(
Expand Down Expand Up @@ -130,3 +140,4 @@ class Prefiltering {
};

#endif

0 comments on commit fea8d20

Please sign in to comment.