feat(query): match GTDB taxonomy for --species and --genus - #48
Merged
Merged
Conversation
ATB stores GTDB names, which split NCBI genera and species into alphabetic clades (Enterococcus_A faecium, Campylobacter jejunii_A). An NCBI-style query such as `atb mlst --species "Enterococcus faecium"` returned zero rows because the stored names never matched verbatim. Strip the GTDB alphabetic suffix from the stored name during comparison. The match is directional: an unsuffixed query matches every clade, while an explicit clade name (Campylobacter_D) still selects only that clade, so clade-specific filtering is preserved. A single matcher (internal/match.SpeciesMatches) backs all filtering paths: the SQLite index resolves matching stored names into an IN clause, the parquet executor and AMR row filter compare per row, and AMR genus partitions expand a requested genus to every on-disk clade partition. Closes #47
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
Fixes #47. ATB stores GTDB names, which split NCBI genera and species into alphabetic clades (
Enterococcus_A faecium,Campylobacter jejunii_A), so an NCBI-style query such asatb mlst --species "Enterococcus faecium"returned zero rows. The GTDB alphabetic suffix is now stripped from the stored name during comparison.The match is directional: an unsuffixed query matches every clade, while an explicit clade name (
Campylobacter_D) still selects only that clade, preserving clade-specific filtering.A single matcher (
internal/match.SpeciesMatches) backs all filtering paths:mlst,query): resolves matching stored names into anIN (...)clausequery): per-row species/genus comparisonamr): row filter plus genus-to-partition expansion (a requested genus expands to every on-disk clade partition) and the HQ sample filterTesting
go test ./...all green;gofmtandgo vetclean; binary buildsgolangci-lintis not installed in the working environment, somake lintwas not run locally; gofmt (checked separately in CI) is cleanCloses #47