Cache-based VCF annotation accelerator
Project description
VCFcache – Cache once, annotate fast
Cache common variants once, reuse them for every sample. VCFcache builds a normalized blueprint, annotates it once, and reuses those results so only rare/novel variants are annotated at runtime.
What’s new
- Single lean Docker image:
ghcr.io/julius-muller/vcfcache:<version> - Caches/blueprints live on Zenodo and are resolved by alias via
public_caches.yaml - Alias schema:
- Blueprint:
bp-<genome>-<source>-<release>-<filt> - Cache:
cache-<genome>-<source>-<release>-<filt>-<tool>-<tool_version>-<preset>
- Blueprint:
- Manifest entries carry
version(vcfcache version used), no image tags - Bundled bcftools 1.22; no Nextflow/JVM required
Quick start (pip install)
Requirements: Python >= 3.11, bcftools >= 1.20
# Install vcfcache
pip install vcfcache
# Run comprehensive demo (tests all 4 commands)
vcfcache demo
# Use it
vcfcache --help
Note: bcftools is a runtime dependency and must be installed separately:
- Ubuntu/Debian:
sudo apt-get install bcftools - macOS:
brew install bcftools - Conda:
conda install -c bioconda bcftools
The demo command runs a complete workflow testing:
blueprint-init- Create cache from variantsblueprint-extend- Add more variantscache-build- Annotate the cacheannotate- Use cache to annotate sample VCF
Quick start (from source)
Requirements: Python 3.13+, uv, bcftools >= 1.20
git clone https://github.com/julius-muller/vcfcache.git
cd vcfcache
uv venv .venv && source .venv/bin/activate
uv pip install -e ".[dev]"
vcfcache --help
python -m pytest tests -q # optional
Quick start (Docker + public cache)
The CLI can fetch caches from Zenodo by alias using the bundled public_caches.yaml.
docker pull ghcr.io/julius-muller/vcfcache:v0.3.0
docker run --rm -v $(pwd):/work ghcr.io/julius-muller/vcfcache:v0.3.0 \
annotate \
-a cache-hg38-gnomad-4.1joint-AF0100-vep-115.2-basic \
--vcf /work/tests/data/nodata/sample4.bcf \
--output /work/out \
--force
List public caches:
vcfcache list --public-caches
Show the recorded annotation command without running it:
vcfcache annotate -a cache-hg38-gnomad-4.1joint-AF0100-vep-115.2-basic --show-command
Build your own cache
- Normalize/deduplicate into a blueprint:
vcfcache blueprint-init \
--vcf gnomad_subset.bcf \
--output ./cache \
-y params.yaml \
--force
- Annotate the blueprint (cache-build) with your recipe:
vcfcache cache-build \
--name vep_custom \
--db ./cache \
-a annotation.yaml \
-y params.yaml \
--force
- Use the cache on samples:
vcfcache annotate \
-a ./cache/cache/vep_custom \
--vcf sample.bcf \
--output ./results \
--force
Manifest & aliases
- Manifest:
public_caches.yaml - Fields (minimum):
alias,type(blueprint|cache),version,genome,source,release,filt,doi,updated_at,md5, plustool/tool_version/presetfor caches. - Aliases:
- Blueprint:
bp-hg38-gnomad-4.1joint-AF0100 - Cache:
cache-hg38-gnomad-4.1joint-AF0100-vep-115.2-basic
- Blueprint:
vcfcache annotate -a <alias>auto-downloads from Zenodo and extracts to~/.cache/vcfcache/caches/<alias>.vcfcache pull --doi <doi> --dest <dir>for manual download/extract.vcfcache push --cache-dir <dir>uploads to Zenodo (requiresZENODO_TOKEN; uses real Zenodo by default).
Configuration (YAML)
Two files, stored with the cache for reproducibility:
params.yaml— resource paths/tools:
bcftools_cmd: "bcftools" # bundled bcftools by default
annotation_tool_cmd: "vep"
tool_version_command: "vep --version"
temp_dir: "/tmp"
optional_checks: {}
annotation.yaml— immutable annotation recipe:
annotation_cmd: |
${params.bcftools_cmd} view ${INPUT_BCF} | \
${params.annotation_tool_cmd} --offline --cache \
--dir_cache ${params.vep_cache} --format vcf --vcf \
-i STDIN -o STDOUT | \
${params.bcftools_cmd} view -o ${OUTPUT_BCF} -Ob -W
must_contain_info_tag: CSQ
required_tool_version: "115.2"
optional_checks:
vep_cache_version: "115"
genome_build: "GRCh38"
Special variables: ${INPUT_BCF}, ${OUTPUT_BCF}, ${AUXILIARY_DIR}, and ${params.*}.
Testing
- From source:
python -m pytest tests -q - In Docker (dev stage):
docker build --target test -f docker/Dockerfile.vcfcache -t vcfcache:test .
docker run --rm vcfcache:test /opt/venv/bin/python -m pytest tests -q
Docker
- Lean runtime:
ghcr.io/julius-muller/vcfcache:v0.3.0(bundled bcftools 1.22) - Multi-stage build:
docker/Dockerfile.vcfcache--target testinstalls dev deps and can run pytest--target finalis the shipped image (small)
Notes
- No Nextflow/JVM needed.
- Caches are portable tarballs; manifest
versionis informational to track which vcfcache built them. - bcftools is bundled and used by default; override via
bcftools_cmdif you need a different binary.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcfcache-0.3.3.tar.gz.
File metadata
- Download URL: vcfcache-0.3.3.tar.gz
- Upload date:
- Size: 93.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c52a59b4e19df34d4f686b55ebc98e49768391abe3b6ed67561640d64040f8e3
|
|
| MD5 |
e7c734c59251843ea2222e9349adcdc1
|
|
| BLAKE2b-256 |
96f0632376086b3f27a591b3e384188acfceea7c5c47bd9036c3957c97fbfc49
|
File details
Details for the file vcfcache-0.3.3-py3-none-any.whl.
File metadata
- Download URL: vcfcache-0.3.3-py3-none-any.whl
- Upload date:
- Size: 69.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8ed6db37469daf484290e09d17609f7135ecc8823d0407a6d42cf22698275bc
|
|
| MD5 |
fec2ff651d240ec0ce20c1a0d8a5c302
|
|
| BLAKE2b-256 |
5252fc480ce6d3cff2c977b256ac29381df3b19ff5aae1ffc680c4cc21b33122
|