Skip to content

Commit

Permalink
Merge pull request #227 from h-2/taxIds
Browse files Browse the repository at this point in the history
[fix] check presence of taxtree in index
  • Loading branch information
sarahet authored Jan 9, 2024
2 parents dc57641 + b16b2d0 commit febf14a
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 * 10 > taxonNames.size())
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 febf14a

Please sign in to comment.