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.3.tar.gz (159.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.3-py3-none-any.whl (111.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vcfcache-0.5.3.tar.gz
  • Upload date:
  • Size: 159.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.3.tar.gz
Algorithm Hash digest
SHA256 210d6440b01b5a32731e0e4a846c7a90b2349f7256866f37878ae253d5a92a9c
MD5 96c86eab0228cc277976b3d833d399e6
BLAKE2b-256 a987cec78bc474adb9866ede074411ccf51e0c6fdfcb918593d14b2928e6facf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vcfcache-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 111.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7f06972ac46776621e2baa118fe4698633fb7442bb163505d3ee60bbf1ca0815
MD5 39f730196a1c4fba0a8a25d797ae5cc9
BLAKE2b-256 70b71c64db0d81df2b1e7c9929c1e57b8ab052843f26266a5ee0a11ea4c7b876

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