Skip to content

Commit

Permalink
All combining various index subset modes for createindex
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Aug 2, 2023
1 parent 91f2a6a commit 8fe3bf9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/commons/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Parameters::Parameters():
// indexdb
PARAM_CHECK_COMPATIBLE(PARAM_CHECK_COMPATIBLE_ID, "--check-compatible", "Check compatible", "0: Always recreate index, 1: Check if recreating index is needed, 2: Fail if index is incompatible", typeid(int), (void *) &checkCompatible, "^[0-2]{1}$", MMseqsParameter::COMMAND_MISC),
PARAM_SEARCH_TYPE(PARAM_SEARCH_TYPE_ID, "--search-type", "Search type", "Search type 0: auto 1: amino acid, 2: translated, 3: nucleotide, 4: translated nucleotide alignment", typeid(int), (void *) &searchType, "^[0-4]{1}"),
PARAM_INDEX_SUBSET(PARAM_INDEX_SUBSET_ID, "--index-subset", "Index subset", "Create specialized index with subset of entries 0: normal index 1: index without headers 1: index without prefiltering data", typeid(int), (void *) &indexSubset, "^[0-2]{1}", MMseqsParameter::COMMAND_EXPERT),
PARAM_INDEX_SUBSET(PARAM_INDEX_SUBSET_ID, "--index-subset", "Index subset", "Create specialized index with subset of entries\n0: normal index\n1: index without headers\n2: index without prefiltering data\nFlags can be combined bit wise", typeid(int), (void *) &indexSubset, "^[0-3]{1}", MMseqsParameter::COMMAND_EXPERT),
// createdb
PARAM_USE_HEADER(PARAM_USE_HEADER_ID, "--use-fasta-header", "Use fasta header", "Use the id parsed from the fasta header as the index key instead of using incrementing numeric identifiers", typeid(bool), (void *) &useHeader, ""),
PARAM_ID_OFFSET(PARAM_ID_OFFSET_ID, "--id-offset", "Offset of numeric ids", "Numeric ids in index file are offset by this value", typeid(int), (void *) &identifierOffset, "^(0|[1-9]{1}[0-9]*)$"),
Expand Down
5 changes: 3 additions & 2 deletions src/prefiltering/PrefilteringIndexReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ void PrefilteringIndexReader::createIndexFile(const std::string &outDB,
(Parameters::isEqualDbtype(seqType, Parameters::DBTYPE_NUCLEOTIDES) || Parameters::isEqualDbtype(seqType, Parameters::DBTYPE_AMINO_ACIDS))
? alphabetSize -1: alphabetSize;

if (indexSubset == Parameters::INDEX_SUBSET_NO_PREFILTER) {
const bool noPrefilter = (indexSubset & Parameters::INDEX_SUBSET_NO_PREFILTER) != 0;
if (noPrefilter) {
splits = 0;
}

ScoreMatrix s3;
ScoreMatrix s2;
if (Parameters::isEqualDbtype(seqType, Parameters::DBTYPE_HMM_PROFILE) == false && indexSubset != Parameters::INDEX_SUBSET_NO_PREFILTER) {
if (Parameters::isEqualDbtype(seqType, Parameters::DBTYPE_HMM_PROFILE) == false && noPrefilter == false) {
int alphabetSize = subMat->alphabetSize;
subMat->alphabetSize = subMat->alphabetSize-1;
s3 = ExtendedSubstitutionMatrix::calcScoreMatrix(*subMat, 3);
Expand Down
5 changes: 3 additions & 2 deletions src/util/indexdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,16 @@ int indexdb(int argc, const char **argv, const Command &command) {
}
}

const bool noHeaders = (par.indexSubset & Parameters::INDEX_SUBSET_NO_HEADERS) != 0;
if (recreate) {
DBReader<unsigned int> *hdbr1 = NULL;
if (par.indexSubset != Parameters::INDEX_SUBSET_NO_HEADERS) {
if (noHeaders == false) {
hdbr1 = new DBReader<unsigned int>(hdr1.c_str(), hdr1Index.c_str(), par.threads, DBReader<unsigned int>::USE_INDEX | DBReader<unsigned int>::USE_DATA);
hdbr1->open(DBReader<unsigned int>::NOSORT);
}

DBReader<unsigned int> *hdbr2 = NULL;
if (sameDB == false && ppDB == false && par.indexSubset != Parameters::INDEX_SUBSET_NO_HEADERS) {
if (sameDB == false && ppDB == false && noHeaders == false) {
hdbr2 = new DBReader<unsigned int>(par.hdr2.c_str(), par.hdr2Index.c_str(), par.threads, DBReader<unsigned int>::USE_INDEX | DBReader<unsigned int>::USE_DATA);
hdbr2->open(DBReader<unsigned int>::NOSORT);
}
Expand Down

0 comments on commit 8fe3bf9

Please sign in to comment.