Skip to content

Commit

Permalink
Correctly compare kmerThr for indexdb compatibility check
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Sep 8, 2023
1 parent 90aa913 commit bb0a1b3
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/util/indexdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void setIndexDbDefaults(Parameters *p) {
p->sensitivity = 5.7;
}

std::string findIncompatibleParameter(DBReader<unsigned int>& index, const Parameters& par, const int dbtype) {
std::string findIncompatibleParameter(DBReader<unsigned int>& index, const Parameters& par, int kmerScore, const int dbtype) {
PrefilteringIndexData meta = PrefilteringIndexReader::getMetadata(&index);
if (meta.compBiasCorr != par.compBiasCorrection)
return "compBiasCorrection";
Expand All @@ -27,13 +27,8 @@ std::string findIncompatibleParameter(DBReader<unsigned int>& index, const Param
return "kmerSize";
if (meta.mask != par.maskMode)
return "maskMode";
if (Parameters::isEqualDbtype(dbtype, Parameters::DBTYPE_HMM_PROFILE)) {
if (meta.kmerThr != par.kmerScore.values.profile())
return "kmerScore";
} else {
if (meta.kmerThr != par.kmerScore.values.sequence())
return "kmerScore";
}
if (meta.kmerThr != kmerScore)
return "kmerScore";
if (meta.spacedKmer != par.spacedKmer)
return "spacedKmer";
if (BaseMatrix::unserializeName(par.seedScoringMatrixFile.values.aminoacid().c_str()) != PrefilteringIndexReader::getSubstitutionMatrixName(&index) &&
Expand Down Expand Up @@ -139,7 +134,7 @@ int indexdb(int argc, const char **argv, const Command &command) {
}

std::string check;
const bool compatible = PrefilteringIndexReader::checkIfIndexFile(&index) && (check = findIncompatibleParameter(index, par, dbr.getDbtype())) == "";
const bool compatible = PrefilteringIndexReader::checkIfIndexFile(&index) && (check = findIncompatibleParameter(index, par, kmerScore, dbr.getDbtype())) == "";
index.close();
if (compatible) {
Debug(Debug::INFO) << "Index is up to date and compatible. Force recreation with --check-compatibility 0 parameter.\n";
Expand Down

0 comments on commit bb0a1b3

Please sign in to comment.