Skip to content

Commit

Permalink
[fix] check presence of taxtree in index
Browse files Browse the repository at this point in the history
  • Loading branch information
h-2 committed Jan 8, 2024
1 parent dc57641 commit 4152fd6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/mkindex_algo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,19 @@ auto parseAndStoreTaxTree(std::vector<bool> & taxIdIsPresent, LambdaIndexerOptio
myPrint(options, 1, "done.\n");
myPrint(options, 2, "Runtime: ", sysTime() - start, "s\n");

taxonNames[0] = "invalid";
taxonNames[0] = "invalid";
size_t taxaWithoutNameCount = 0;
for (uint32_t i = 0; i < std::ranges::size(taxonNames); ++i)
{
if (taxIdIsPresentOrParent[i] && empty(taxonNames[i]))
{
std::cerr << "Warning: Taxon with ID " << i << " has no name associated, defaulting to \"n/a\".\n";
taxonNames[i] = "n/a";
++taxaWithoutNameCount;
}
}
if (taxaWithoutNameCount * 100 / taxonNames.size() > 10)
std::cerr << "Warning: More than 10% of taxa have no valid name entry.\n";

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/search_algo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void loadDbIndexFromDisk(
myPrint(options, 2, " size of search space: ", searchSpaceSize, "\n");
bool const indexHasSTaxIDs = globalHolder.indexFile.sTaxIds.size() == globalHolder.indexFile.seqs.size();
myPrint(options, 2, " has taxonomic IDs: ", indexHasSTaxIDs, "\n");
bool const indexHasTaxTree = globalHolder.indexFile.taxonNames.size() >= globalHolder.indexFile.seqs.size();
bool const indexHasTaxTree = !globalHolder.indexFile.taxonNames.empty();
myPrint(options, 2, " has taxonomic tree: ", indexHasTaxTree, "\n");
myPrint(options, 2, "Runtime: ", finish, "s \n\n");

Expand Down

0 comments on commit 4152fd6

Please sign in to comment.