Skip to main content

vaxtract

PyPI Python License: MIT Tests

Schema-validated extraction of neoantigen cancer-vaccine immunogenicity data from primary papers, built on the Claude Agent SDK. 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 Anthropic usage (~$3/paper, varies). Your files never leave your machine — there is no hosted 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 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   # use plan quota

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

A prebuilt multi-arch image bundles Python, the agent, and the Claude Code CLI — bring only your key:

docker pull sahuno/vaxtract:latest
docker run --rm -e ANTHROPIC_API_KEY \
    -v "$PWD/my_paper_dir:/work/my_paper_dir" \
    sahuno/vaxtract:latest /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/ the package: schema (core) + the agent loop, tools, prompt rendering ([agent])
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.2.1

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.2.1
File Size Uploaded
vaxtract-0.2.1.tar.gz 210.3 kB Details

Built distribution (wheel)

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

Total release size: 362.8 kB

Release files / vaxtract-0.2.1.tar.gz

Download URL vaxtract-0.2.1.tar.gz
Size 210.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6e195d3e96ec0c5b909a3da2667bcb5659e138b98594b1e1774ce139f05c8c9e
BLAKE2b-256 checksum
How to use checksums
9bf184f7b4ac32a2734280bdd5b90ac4a266e8116530b5b81252e34da4641945
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 30, 2026.

Transparency log

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

Download URL vaxtract-0.2.1-py3-none-any.whl
Size 152.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
464b08690630cac8fe32874a190e4d7faf7f363514504d11ce992c5f7ee3888d
BLAKE2b-256 checksum
How to use checksums
e63786bfe1c411924828bc5a29c6fb40ed6b6b26cc30fa0bc43d3d51d47f05e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 30, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.1 This release

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