Skip to main content

Cache-based VCF annotation accelerator

Project description

DOI CI License PyPI Cite codecov

VCFcache – cache once, annotate fast

VCFcache builds a normalized blueprint of common variants, annotates it once, and reuses those annotations so only novel variants are processed at runtime. It is genome‑agnostic and tool‑agnostic (VEP, SnpEff, ANNOVAR, custom scripts).

Important: to use a cache, you must have the same annotation tool (and compatible version) installed locally.

See WIKI.md for full documentation, performance notes, and cache distribution via Zenodo.


Quick Start (containers: Docker or Apptainer)

Containers include a modern bcftools, which avoids OS‑level version issues.

docker pull ghcr.io/julius-muller/vcfcache:latest

# List available public caches
docker run --rm ghcr.io/julius-muller/vcfcache:latest list caches

# Use a public cache from Zenodo
docker run --rm -v $(pwd):/work ghcr.io/julius-muller/vcfcache:latest \
  annotate \
    -a cache-hg38-gnomad-4.1joint-AF0100-vep-115.2-basic \
    --vcf /work/sample.vcf.gz \
    --output /work/sample_vc.bcf \
    --stats-dir /work

Apptainer/Singularity (example):

apptainer exec docker://ghcr.io/julius-muller/vcfcache:latest \
  vcfcache list caches

Quick Start (pip)

Requires: Python >= 3.11 and bcftools >= 1.20.

uv pip install vcfcache
vcfcache demo -q
vcfcache --help

Install bcftools separately:

  • Ubuntu/Debian: sudo apt-get install bcftools
  • macOS: brew install bcftools
  • Conda: conda install -c bioconda bcftools

Quick Start (from source with test suite)

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

Build your own cache

  1. Create blueprint (normalize/deduplicate variants):
vcfcache blueprint-init --vcf gnomad.bcf --output ./cache -y params.yaml
  1. Annotate blueprint (create cache):
vcfcache cache-build --name vep_cache --db ./cache -a annotation.yaml -y params.yaml
  1. Use cache on samples:
vcfcache annotate --requirements -a ./cache/cache/vep_cache
vcfcache annotate -a ./cache/cache/vep_cache --vcf sample.vcf.gz --output ./sample_vc.bcf --stats-dir ./results

If --stats-dir is provided, stats are written to <stats_dir>/<input_basename>_vcstats. Otherwise, they default to <cwd>/<input_basename>_vcstats. Use --no-stats to skip writing stats/logs (disables vcfcache compare).


Public caches/blueprints (Zenodo)

List and download:

vcfcache list caches
vcfcache list blueprints
vcfcache cache-build --doi <DOI>                 # download cache
vcfcache blueprint-init --doi <DOI> -o ./cache   # download blueprint

Use a downloaded cache:

vcfcache annotate -a ~/.cache/vcfcache/caches/<cache_name> --vcf sample.vcf.gz --output sample_vc.bcf

params.yaml (runtime settings)

params.yaml defines tool paths and runtime settings (e.g., bcftools_cmd, annotation_tool_cmd, threads, temp_dir, genome_build).
Pass it with -y/--yaml for cache-build and annotate. If omitted for annotate, the cache’s params.snapshot.yaml is used.

annotation.yaml (annotation recipe)

annotation.yaml defines the annotation command, required tool version, and output tag (must_contain_info_tag).
It is required for cache-build (-a/--anno-config) and is stored in the cache as annotation.snapshot.yaml.

The key field is annotation_cmd. It is a shell command string that must read from $INPUT_BCF and write to $OUTPUT_BCF.
You can include $AUXILIARY_DIR for tool side‑outputs. This is typically a direct translation of your annotation pipeline.

To see requirements for a downloaded cache, run:

vcfcache annotate --requirements -a <cache_dir>

For publishing to Zenodo, prepare a metadata YAML and use vcfcache push (details in the wiki).

Minimal example (bcftools annotate):

annotation_cmd: "bcftools annotate -a /path/to/anno.bcf -c INFO -o $OUTPUT_BCF -Ob -W --threads ${params.threads} $INPUT_BCF"
must_contain_info_tag: "CSQ"
required_tool_version: "1.0"
genome_build: "GRCh38"

Stats directory contents

<input_basename>_vcstats contains:

  • annotation.log and workflow.log — run logs and timing breakdown.
  • workflow/params.snapshot.yaml and workflow/annotation.snapshot.yaml — exact configs used for the run.
  • auxiliary/ — tool side‑outputs (e.g., VEP stats).
  • compare_stats.yaml and .vcfcache_complete — summary metrics and completion metadata.

Configuration (common)

Override system bcftools (if needed):

export VCFCACHE_BCFTOOLS=/path/to/bcftools-1.22

Change where downloaded caches/blueprints are stored (default: ~/.cache/vcfcache):

export VCFCACHE_DIR=/path/to/vcfcache_cache_dir

Or in params.yaml:

bcftools_cmd: "/path/to/bcftools"

See WIKI.md for detailed configuration, cache distribution via Zenodo, and troubleshooting.


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vcfcache-0.5.2.tar.gz (158.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vcfcache-0.5.2-py3-none-any.whl (110.5 kB view details)

Uploaded Python 3

File details

Details for the file vcfcache-0.5.2.tar.gz.

File metadata

  • Download URL: vcfcache-0.5.2.tar.gz
  • Upload date:
  • Size: 158.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for vcfcache-0.5.2.tar.gz
Algorithm Hash digest
SHA256 78713a79e55f8acb82e7b1ee05185f7678c6a0e42a08d8490a3146e869d926c2
MD5 b74b4921b3dddf2999f57ee4ba4aeed1
BLAKE2b-256 363537b2307147add71d62eae998faeb934d70c65f5de5320a0206052559a859

See more details on using hashes here.

File details

Details for the file vcfcache-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: vcfcache-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 110.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for vcfcache-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5590f87ea45387c6598b16d5f9a576e550aca9f228900b0462d391ea0aef65
MD5 dbbf19af3188f25bfb6d529a4ffd84ae
BLAKE2b-256 00184c234c180d4dea2789f05e68af96ab9867f450138f49dd843d93d9034d11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page