Skip to main content

vaxtract

PyPI Python License: MIT Tests

Schema-validated extraction of neoantigen cancer-vaccine immunogenicity data from primary papers. The default runtime is the Claude Agent SDK; --profile grok (and other OpenAI-compatible endpoints) is experimental. Point it at a folder of paper files (PDF / XLSX / DOCX) and it returns a schema-validated, provenance-tracked JSON extraction (per-peptide / per-epitope immunogenicity, HLA restriction, evidence, survival outcomes, …) for human sign-off.

Bring your own key (BYOK). You run the agent and pay for your own model usage (~$3/paper, varies). Your files never leave your machine unless you choose a hosted runner. There is no public upload service.

Output is silver, not gold. Every record carries provenance and is meant for a curator to review before use, not to be treated as ground truth.

This is the open-source extraction engine behind the NeoVax Atlas — a curated database of neoantigen cancer-vaccine trials. The agent's design and validation are described in the accompanying paper (see Citation).


Install

pip install vaxtract                    # core: the schema/vocab data contract only (pydantic)
pip install "vaxtract[agent]"           # + the extraction agent (Claude Agent SDK + readers)
pip install "vaxtract[agent,figures]"   # + figure/image reading (PyMuPDF + Pillow)
pip install "vaxtract[compat]"          # + OpenAI-compatible runtime (Grok / GPT / vLLM)

pip install vaxtract pulls only pydantic, so you can import vaxtract.schema to validate records without the Claude Agent SDK. Running the agent (the vaxtract console script or vaxtract.extract_paper) needs the [agent] extra.

Running the agent also requires Python ≥ 3.10 and the Claude Code CLI on your PATH (the Agent SDK shells out to the claude binary):

npm install -g @anthropic-ai/claude-code

(The Docker image below bundles this for you.)

Authenticate (pick one)

export ANTHROPIC_API_KEY=sk-ant-...     # A) API key — pay-per-token
# B) Claude subscription — pass --subscription to use a logged-in plan via the `claude` CLI

Run

vaxtract ./my_paper_dir out.json
vaxtract --subscription ./my_paper_dir out.json   # Claude plan quota
vaxtract --profile grok ./my_paper_dir out.json   # XAI_API_KEY; experimental

--subscription is Claude-only. Non-Claude profiles (grok, gpt, inkling, nemotron, qwen) are experimental — see docs/MODEL_AGNOSTIC_RUNTIME.md.

my_paper_dir is a folder containing the paper's .pdf and any supplementary .xlsx / .docx. The agent reads the tables/text/figures, builds the record, self-validates against the schema, and writes out.json.

As a library

import asyncio
from vaxtract import extract_paper
asyncio.run(extract_paper("./my_paper_dir", "out.json"))

The data contract is importable without the SDK:

from vaxtract.schema import ExtractedPaper, SCHEMA_VERSION

Run with Docker

Multi-arch images on GHCR. latest includes the Claude CLI; compat is the slim Grok/GPT image (no Node).

docker pull ghcr.io/mskgreenbaumlab/vaxtract:latest
docker run --rm -e ANTHROPIC_API_KEY \
    -v "$PWD/my_paper_dir:/work/my_paper_dir" \
    ghcr.io/mskgreenbaumlab/vaxtract:latest \
    /work/my_paper_dir /work/my_paper_dir/out.json

docker pull ghcr.io/mskgreenbaumlab/vaxtract:compat
docker run --rm -e XAI_API_KEY \
    -v "$PWD/my_paper_dir:/work/my_paper_dir" \
    ghcr.io/mskgreenbaumlab/vaxtract:compat \
    --profile grok /work/my_paper_dir /work/my_paper_dir/out.json

What it extracts

Per paper: studies, patients, immunizing peptides, minimal epitopes, pools, immunogenicity evidence (assay / outcome / magnitude), neoantigen mutations, survival outcomes, clinical-benefit signals, safety, and vaccine-delivery covariates — all validated against a versioned Pydantic schema (SCHEMA_VERSION).

How it works

The model is given tools and a loop: it reads tables/text/figures itself, drafts candidate JSON, calls validate(), reads the schema's errors, and fixes its own output until the record passes or an outer guard quarantines it for review. Pure logic (agent_core.py, prompt_render.py) is SDK-free and unit-tested; the SDK shell wraps it as in-process tools.

flowchart LR
    A["Paper dir<br/>PDF · XLSX · DOCX · figures"] --> B[Read sources]
    B --> C[Draft / amend record]
    C --> D{"validate()"}
    D -- errors --> C
    D -- passes --> E["finalize:<br/>faithfulness guards"]
    E -- clean --> F[("Schema-valid JSON")]
    E -- flagged --> G[["needs_review"]]

See docs/ARCHITECTURE.md for the full design.

Reproducibility

The agent calls a proprietary, versioned, non-deterministic model, and the validation corpus is copyright-restricted — so the gold reference_records/ (audited extractions) are the reproducibility anchor, not byte-identical re-runs. See REPRODUCIBILITY.md.

Repository layout

Path What
vaxtract/ schema (core) + tool registry + Claude / OpenAI-compat runtimes
cancervac_packet/ schema/vocab re-export shims + reporting + the pre-deploy validation gate
tests/ the test suite (pytest)
reference_records/ audited gold extractions — the validation set
lite_extract/ a lightweight prompt-only extraction variant + its RULES
scale/ optional HPC batch lane (Snakemake + Singularity), sanitized example config
eval/ extraction scoring (precision/recall vs gold)
docs/ architecture and schema documentation

Citation

If you use vaxtract, please cite it — see CITATION.cff (a DOI is minted on release via Zenodo). A .bib entry will be added with the published paper.

License

MIT © 2026 Samuel Ahuno

Metadata

Release files for vaxtract 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 vaxtract 0.3.0
File Size Uploaded
vaxtract-0.3.0.tar.gz 219.3 kB Details

Built distribution (wheel)

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

Total release size: 380.3 kB

Release files / vaxtract-0.3.0.tar.gz

Download URL vaxtract-0.3.0.tar.gz
Size 219.3 kB
Tags Source
SHA-256 checksum
How to use checksums
41da28d299f8f42d368af35a4405e71afd7dbd76472fe30435be2eb7a6339f54
BLAKE2b-256 checksum
How to use checksums
a5efc22199571b013a415f28de9298157fcb4a4123e19730e883580978f37175
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 Aug 24, 2026.

Transparency log

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

Download URL vaxtract-0.3.0-py3-none-any.whl
Size 161.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
416a85e1def667438fd94abfe2d80ff5728c401b1a9377c24dfc89480c917d86
BLAKE2b-256 checksum
How to use checksums
d3b5172447671e4daff715b7f0da32b5a94dfe20393ba64e22797cd7f846cf3b
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 Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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