fix(gtdb-parser): respect --use_ncbi_taxonomy in novel-species filter#13
Merged
thanhleviet merged 1 commit intoMay 19, 2026
Merged
Conversation
The novel-species filter read the raw gtdb_taxonomy column while --use_ncbi_taxonomy rewrites only the species column. This caused genomes with NCBI-named species but GTDB placeholder taxonomy (e.g. NCBI Shigella flexneri / GTDB s__ECMA0423 sp047199055) to be dropped, ultimately yielding zero S. flexneri in the Escherichia/Shigella build. Switch the filter to read the species column so it sees post-rewrite names. Add na=False to tolerate rows missing a species call, which the species column (unlike gtdb_taxonomy) does not guarantee to populate.
Michal-Babins
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The novel-species filter at
GtdbSpreadsheetParser.py:166was reading the rawgtdb_taxonomycolumn to drop GTDB placeholder species (sp###), but--use_ncbi_taxonomyand--ncbi_whitelistonly rewrite the derivedspeciescolumn. As a result, genomes whose NCBI name is a real species but whose GTDB name is a placeholder were silently dropped — most visibly losing 797 of 837 Shigella flexneri rows and yielding zero S. flexneri in the final Escherichia/Shigella database.This PR points the filter at the
speciescolumn instead. Default builds are unaffected because both columns hold the same value when no rename flag is set. Builds with--use_ncbi_taxonomyor--ncbi_whitelistnow correctly preserve NCBI-named species. Addedna=Falseso blank cells in thespeciescolumn don't raise during the regex check.Changes
gambitdb/GtdbSpreadsheetParser.py:166— switch column fromgtdb_taxonomytospecies; addna=False.Test plan
GtdbSpreadsheetParserunit tests pass (2/2 green); 10 unrelated pre-existing failures in the wider suite are present on unmodified main and not caused by this change.--use_ncbi_taxonomy: Shigella flexneri now appears withngenomes=6(was 0 before fix).--use_ncbi_taxonomy: genuinesp\d+$placeholders still correctly dropped (regression check).ngenomesinspecies_taxa.csvfor the affected species.--use_ncbi_taxonomyor--ncbi_whitelist— the same rows are dropped becausespeciesis derived fromgtdb_taxonomyin that path.Out of scope
A secondary issue exists where species whose accessions are removed by the minimum-genomes filter still appear in
species_taxa.csvwith emptyngenomes(lines 202-235). This is independent of the column-mismatch bug fixed here and can fire under any flag combination. To be addressed in a follow-up.