Skip to main content

gapit

Mass screening of contigs and reads for antimicrobial resistance and virulence genes. An agent-first Python reimplementation of abricate: byte-compatible TSV plus first-class JSON and Markdown.

Why gapit

  • Drop-in abricate replacement. Same BLAST pipeline, same hit rules, abricate-format TSV on stdout. Parity with abricate 1.4.0 is a release gate, checked by diffing gene calls against real abricate (pixi run -e parity parity).
  • Machine-readable by design. Versioned output schemas (gapit.report/1, gapit.reads/1, gapit.summary/1), self-describing via gapit schema, typed JSON error envelopes on stderr, documented exit codes. An agent can discover the whole contract without reading docs.
  • Reads, not just contigs. gapit screen --r1/--r2 screens FASTQ through minimap2, and --r1 accepts assembly FASTA directly (content-detected, map-ont forced) for a fast presence survey. abricate cannot screen raw reads.

Install

From PyPI (external BLAST+ and minimap2 binaries required on PATH — see docs/installation.md):

pip install gapit

Or from a git clone with pixi, which manages the environment including the external binaries:

git clone https://github.com/indexofire/gapit.git
cd gapit
pixi install
pixi run gapit --version

The package supports Python 3.11+; the dev environment pins 3.14.

Quick start

# Screen contigs (abricate-compatible TSV on stdout, --db defaults to ncbi)
gapit screen contigs.fa --db ncbi

# Agent- and human-readable outputs
gapit screen contigs.fa --db ncbi --format json
gapit screen contigs.fa --format md

# Screen FASTQ reads; --read-type picks the minimap2 preset
gapit screen --r1 sample_R1.fastq.gz --r2 sample_R2.fastq.gz --read-type sr --db card
gapit screen --r1 ont_reads.fastq.gz --read-type map-ont --format json

# Summarize report tables into a gene presence/absence matrix
gapit summary *.tsv

# Databases: card + vfdb install offline from bundled snapshots, others fetch on demand
gapit db fetch
gapit db fetch ncbi
gapit db list
gapit db outdated                # flag stale databases and newer bundled snapshots
gapit db search "tet(M)"         # look up genes across every installed database
gapit db build mydb my_genes.fa --tsv my_meta.tsv   # custom db from any FASTA

# Introspection
gapit schema report     # JSON Schema of gapit.report/1

Contig screening follows abricate defaults (--minid 80, --mincov 80). Reads-mode presence defaults to 90% alignment breadth (--min-breadth 90).

Databases

A database is a directory under the datadir, resolved from $GAPIT_DATADIR, then ~/.local/share/gapit/db (override per call with --datadir). Twelve providers exist; card and vfdb ship inside the wheel and install with zero network, the rest download from upstream when fetched.

Name Content dbtype
ncbi NCBI AMRFinderPlus curated AMR (default db) nucl
card CARD protein homolog resistance models nucl
resfinder CGE ResFinder acquired resistance genes nucl
argannot ARG-ANNOT acquired resistance genes nucl
plasmidfinder CGE PlasmidFinder replicons nucl
megares MEGARes antimicrobial resistance genes nucl
ecoh E. coli O and H antigens (srst2 EcOH) nucl
vfdb VFDB virulence factors (set A, nucleotide) nucl
ecoli_vf E. coli virulence factors nucl
bacmet2 BacMet2 biocide/resistance genes (protein) prot
victors Victors virulence factors nucl
upec_expec_vf UPEC/ExPEC virulence genes nucl

gapit also reads datadirs built by abricate itself (legacy ~~~ headers). The reverse does not hold: gapit-native databases use the gapit/v1 header format (see SPEC.md §11), which abricate cannot read. Protein databases such as bacmet2 screen through blastx.

Output contract

  • stdout purity. Data on stdout, diagnostics on stderr, always. --quiet silences stderr only.
  • Deterministic. Stable sort orders, fixed tool parameters, no wall-clock timestamps inside data payloads.
  • Errors print a JSON envelope to stderr and exit nonzero:
{"schema": "gapit.error/1", "code": "...", "message": "...", "context": {...}}
Exit code Meaning
0 success
1 unexpected error
2 usage error
3 missing dependency
4 database error
5 input error

MCP server

gapit ships an MCP (Model Context Protocol) stdio server so agent runtimes can screen assemblies without parsing CLI output: gapit mcp or the gapit-mcp console script speaks newline-delimited JSON-RPC 2.0 on stdin/stdout (no extra dependencies — the protocol is hand-rolled). It exposes nine tools: screen (gapit.report/1 by default; aligner minimap2 for a fast assembly survey), screen_reads (FASTQ via minimap2, gapit.reads/1), summary (gapit.summary/1), schema, db_list, plus the database tools db_fetch, db_build, db_search, and db_outdated so an agent can self-provision and inspect databases mid-session. Tool failures return isError: true with the gapit.error/1 envelope as text. Register it with an MCP client:

{"mcpServers": {"gapit": {"command": "gapit-mcp"}}}

Development

Task Runs
pixi run lint ruff check
pixi run fmt ruff format
pixi run typecheck basedpyright (strict)
pixi run test pytest, 374 offline tests
pixi run -e parity parity byte-diff screening vs real abricate
pixi run -e parity summary-parity byte-diff summary vs real abricate

User documentation lives in docs/index.md, rendered at https://indexofire.github.io/gapit/.

SPEC.md is the parity contract, PLAN.md the roadmap, AGENTS.md the contributor guide, CHANGELOG.md the change history.

License

gapit is MIT-licensed. It is a behavioral reimplementation of abricate (GPL-2.0) and copies no Perl code; abricate itself remains GPL-2.0. Bundled database content retains its original upstream licenses (SPEC.md §9).

Metadata

Release files for gapit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gapit 0.3.0
File Size Uploaded Provenance
gapit-0.3.0.tar.gz 3.0 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gapit 0.3.0
File Interpreter ABI Platform
gapit-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 MB

Release files / gapit-0.3.0.tar.gz

Download URL gapit-0.3.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f9b1175c506daead4752145bf26928e5667024271cdafa27b0f928dfb8b0960d
BLAKE2b-256 checksum
How to use checksums
3370278ef34f80d07e10f19acb300f0c54e73ac39f5c305f97fce40620937255
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / gapit-0.3.0-py3-none-any.whl

Download URL gapit-0.3.0-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
de7d2c4ce0bac0fb9a3b8ded9fbbfe699f32c79325e05ef8e1956eae1390368d
BLAKE2b-256 checksum
How to use checksums
c2184a07ba684630c3ee7b74f905284b9a1fe38fe45b64df93e1e1466ebf3270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for gapit 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gapit-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page