Skip to content

Commit b16b2d0

Browse files
committed
[fix] check presence of taxtree in index
1 parent dc57641 commit b16b2d0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/mkindex_algo.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,19 @@ auto parseAndStoreTaxTree(std::vector<bool> & taxIdIsPresent, LambdaIndexerOptio
580580
myPrint(options, 1, "done.\n");
581581
myPrint(options, 2, "Runtime: ", sysTime() - start, "s\n");
582582

583-
taxonNames[0] = "invalid";
583+
taxonNames[0] = "invalid";
584+
size_t taxaWithoutNameCount = 0;
584585
for (uint32_t i = 0; i < std::ranges::size(taxonNames); ++i)
585586
{
586587
if (taxIdIsPresentOrParent[i] && empty(taxonNames[i]))
587588
{
588589
std::cerr << "Warning: Taxon with ID " << i << " has no name associated, defaulting to \"n/a\".\n";
589590
taxonNames[i] = "n/a";
591+
++taxaWithoutNameCount;
590592
}
591593
}
594+
if (taxaWithoutNameCount * 10 > taxonNames.size())
595+
std::cerr << "Warning: More than 10% of taxa have no valid name entry.\n";
592596

593597
return ret;
594598
}

src/search_algo.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ void loadDbIndexFromDisk(
296296
myPrint(options, 2, " size of search space: ", searchSpaceSize, "\n");
297297
bool const indexHasSTaxIDs = globalHolder.indexFile.sTaxIds.size() == globalHolder.indexFile.seqs.size();
298298
myPrint(options, 2, " has taxonomic IDs: ", indexHasSTaxIDs, "\n");
299-
bool const indexHasTaxTree = globalHolder.indexFile.taxonNames.size() >= globalHolder.indexFile.seqs.size();
299+
bool const indexHasTaxTree = !globalHolder.indexFile.taxonNames.empty();
300300
myPrint(options, 2, " has taxonomic tree: ", indexHasTaxTree, "\n");
301301
myPrint(options, 2, "Runtime: ", finish, "s \n\n");
302302

0 commit comments

Comments
 (0)