Skip to content

Exposing --species-like for amr queries #33

Closed

Description

@jhawkey

Hi,

Would it be possible to use --species-like with amr queries also?

Want to be able to run this command, but apparently it's only available for atb query?

atb amr --hq-only --species-like "Campylobacter_D jej%" --format tsv --output $ORG_DIR/raw_${ORG_DIR}_AMRFP.tsv

Activity

  1. thanhleviet commented on Aug 5, 2026

    @thanhleviet
    Collaborator

    Implemented in #41, now on main.

    atb amr accepts --species-like, so your command works as written:

    atb amr --hq-only --species-like "Campylobacter_D jej%" --format tsv --output $ORG_DIR/raw_${ORG_DIR}_AMRFP.tsv

    Pattern rule. % matches any sequence of characters; every other character, including _, matches itself. GTDB clade names such as Campylobacter_D and Enterococcus_B therefore work as typed. atb query --species-like follows the same rule.

    It is not a full scan. The AMR data is partitioned per genus, and the literal text before the first % decides which partition files can hold a match. "Campylobacter_D jej%" reads only the Campylobacter_D partition (plus the shared partition that holds genera too small for their own file, which is ~2% of samples). "Streptococcus%" reads every Streptococcus* partition. Only a pattern that starts with % names no genus and has to scan the full dataset, and in that case the command prints a note telling you so and suggesting you anchor the pattern.

    --species-like also counts as a filter for the "scan everything?" confirmation, so it does not ask for --yes.

    Verified against the real dataset with exactly the command above: 277,638 rows, covering Campylobacter_D jejuni, Campylobacter_D jejuni_A, and Campylobacter_D jejuni_D. That last detail is worth flagging - the two lettered sub-clades are ones an exact --species "Campylobacter_D jejuni" match drops silently, so the wildcard is likely giving you a more complete answer than the exact flag would have.

    One related fix rode along: patterns with an interior wildcard, such as "Enterococcus%faecium" (the form the docs recommend for searching across GTDB naming variants), previously fell back to an exact string comparison on one of the two execution paths. Both paths now share a single matcher, so they agree.

    A release including this is being cut now; I will follow up here with the version.

  2. thanhleviet commented on Aug 5, 2026

    @thanhleviet
    Collaborator

    Released in v0.19.0 - atb amr --species-like "Campylobacter_D jej%" now works, reading only the matching genus partitions rather than scanning the full dataset.

    Upgrade with the installer or grab a binary from the release page; releases/latest now points at v0.19.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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