Skip to content

Commit

Permalink
Merge commit 'f740aa67620f53e482a3575d5c2b1e488c78c968'
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Jan 12, 2025
2 parents 109429a + f740aa6 commit 68388e2
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions lib/mmseqs/src/prefiltering/IndexBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,55 +180,54 @@ void IndexBuilder::fillDatabase(IndexTable *indexTable, SequenceLookup ** extern
}

delete info;
Debug::Progress progress2(dbTo-dbFrom);

Debug(Debug::INFO) << "Index table: fill\n";
#pragma omp parallel
{
unsigned int thread_idx = 0;
if(indexTable != NULL) {
Debug::Progress progress2(dbTo - dbFrom);
Debug(Debug::INFO) << "Index table: fill\n";
#pragma omp parallel
{
unsigned int thread_idx = 0;
#ifdef OPENMP
thread_idx = static_cast<unsigned int>(omp_get_thread_num());
thread_idx = static_cast<unsigned int>(omp_get_thread_num());
#endif
Sequence s(seq->getMaxLen(), seq->getSeqType(), &subMat, seq->getKmerSize(), seq->isSpaced(), false, true, seq->getUserSpacedKmerPattern());
unsigned int alphabetSize = (indexTable != NULL) ? static_cast<unsigned int>(indexTable->getAlphabetSize())
: static_cast<unsigned int>(subMat.alphabetSize);
Indexer idxer(alphabetSize, seq->getKmerSize());
IndexEntryLocalTmp *buffer = static_cast<IndexEntryLocalTmp *>(malloc( seq->getMaxLen() * sizeof(IndexEntryLocalTmp)));
size_t bufferSize = seq->getMaxLen();
KmerGenerator *generator = NULL;
if (isTargetSimiliarKmerSearch) {
generator = new KmerGenerator(seq->getKmerSize(), indexTable->getAlphabetSize(), kmerThr);
if(isProfile){
generator->setDivideStrategy(s.profile_matrix);
}else{
generator->setDivideStrategy(&three, &two);
Sequence s(seq->getMaxLen(), seq->getSeqType(), &subMat, seq->getKmerSize(), seq->isSpaced(), false, true,
seq->getUserSpacedKmerPattern());
unsigned int alphabetSize = (indexTable != NULL) ? static_cast<unsigned int>(indexTable->getAlphabetSize())
: static_cast<unsigned int>(subMat.alphabetSize);
Indexer idxer(alphabetSize, seq->getKmerSize());
IndexEntryLocalTmp *buffer = static_cast<IndexEntryLocalTmp *>(malloc(
seq->getMaxLen() * sizeof(IndexEntryLocalTmp)));
size_t bufferSize = seq->getMaxLen();
KmerGenerator *generator = NULL;
if (isTargetSimiliarKmerSearch) {
generator = new KmerGenerator(seq->getKmerSize(), indexTable->getAlphabetSize(), kmerThr);
if (isProfile) {
generator->setDivideStrategy(s.profile_matrix);
} else {
generator->setDivideStrategy(&three, &two);
}
}
}

#pragma omp for schedule(dynamic, 100)
for (size_t id = dbFrom; id < dbTo; id++) {
s.resetCurrPos();
progress2.updateProgress();
#pragma omp for schedule(dynamic, 100)
for (size_t id = dbFrom; id < dbTo; id++) {
s.resetCurrPos();
progress2.updateProgress();

unsigned int qKey = dbr->getDbKey(id);
if (isTargetSimiliarKmerSearch) {
s.mapSequence(id - dbFrom, qKey, dbr->getData(id, thread_idx), dbr->getSeqLen(id));
if(indexTable != NULL) {
unsigned int qKey = dbr->getDbKey(id);
if (isTargetSimiliarKmerSearch) {
s.mapSequence(id - dbFrom, qKey, dbr->getData(id, thread_idx), dbr->getSeqLen(id));
indexTable->addSimilarSequence(&s, generator, &buffer, bufferSize, &idxer);
}
} else {
s.mapSequence(id - dbFrom, qKey, sequenceLookup->getSequence(id - dbFrom));
if(indexTable != NULL) {
} else {
s.mapSequence(id - dbFrom, qKey, sequenceLookup->getSequence(id - dbFrom));
indexTable->addSequence(&s, &idxer, &buffer, bufferSize, kmerThr, idScoreLookup);
}
}
}

if (generator != NULL) {
delete generator;
}
if (generator != NULL) {
delete generator;
}

free(buffer);
free(buffer);
}
}
if(idScoreLookup!=NULL){
delete[] idScoreLookup;
Expand Down

0 comments on commit 68388e2

Please sign in to comment.