Skip to content

gtdb_ground.py results are batch-sensitive: the same taxon grounds differently per-record vs whole-KB #366

Description

@realmarcin

Found reviewing PR #364. Pre-existing.

collect_rows() breaks after the first matching rank column, so which rank a mapping row is indexed under depends on which other taxa are in the same run. The same taxon can therefore resolve differently depending on batch composition.

Demonstrated with Euryarchaeota (NCBITaxon:28890, in High_Solids_Switchgrass_Methanogenic_Microbiome.yaml):

  • ungrounded-only batch → AMBIGUOUS (no block emitted)
  • whole-KB batch → grounds to GTDB:p__Halobacteriota

This matters twice over:

  1. The remediation advice in Ground the taxon left stale by an id edit, and pin grounding to its source id (#314) #364's new test is batch-sensitive. Its failure message says "re-run gtdb_ground.py --apply on these records" — a per-record run may not reproduce what a whole-KB run produced, or vice versa.
  2. Grounding is not reproducible from the record alone, which undercuts mapping_source as provenance: the same mapping release and the same id can yield different answers.

Fix: make collect_rows() index a row under every rank it matches rather than breaking at the first, so resolution depends only on the taxon and the mapping table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions