API reference¶
vepyr.build_cache(release, cache_dir, *, cache_type, species='homo_sapiens', assembly='GRCh38', partitions=8, cache_format='parquet', local_cache=None, download_retries=10, show_progress=True, on_progress=None, overwrite=False)
¶
Download an Ensembl VEP cache and convert it to an optimized cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
release
|
int
|
Ensembl release number (e.g. 115). |
required |
cache_dir
|
str
|
Root directory for cache data and Parquet output. |
required |
cache_type
|
str
|
Required Ensembl VEP cache type: |
required |
species
|
str
|
Species name (default: |
'homo_sapiens'
|
assembly
|
str
|
Genome assembly (default: |
'GRCh38'
|
partitions
|
int
|
Number of DataFusion partitions for parallelism (default: 8). |
8
|
cache_format
|
str
|
Cache format to build. Only |
'parquet'
|
local_cache
|
str or None
|
Path to an already-unpacked Ensembl VEP cache directory (the one
containing |
None
|
download_retries
|
int
|
Maximum number of resume-retries for the cache download (default: 10). Each retry resumes from the last byte received. |
10
|
show_progress
|
bool
|
Show tqdm progress bars during conversion (default: True). .. note::
The partitioned-Parquet build path does not currently emit
per-batch progress events, so no bars appear during the cache
build regardless of |
True
|
on_progress
|
callable or None
|
Custom progress callback with signature
|
None
|
overwrite
|
bool
|
Rebuild existing cache outputs instead of skipping them. |
False
|
Returns:
| Type | Description |
|---|---|
list[tuple[str, int]]
|
List of |
vepyr.build_plugin_cache(plugin, version, *, source_path, cache_dir, plugin_cache_root, chroms=None, plugins_repo=None, overwrite=False)
¶
Build a per-chromosome plugin cache.
plugin/version select plugins/<plugin>/<plugin>.source.toml from
the public vepyr-plugins repo at that git tag (or plugins_repo for
offline). Tiering is inherited from the variation cache at cache_dir.
Returns per-chrom (chrom, rows, warm, cold) tuples.
vepyr.annotate(vcf, cache_dir, *, everything=False, hgvs=False, hgvsc=False, hgvsp=False, shift_hgvs=None, no_escape=False, remove_hgvsp_version=False, hgvsp_use_prediction=False, reference_fasta=None, check_existing=False, af=False, af_1kg=False, af_gnomade=False, af_gnomadg=False, max_af=False, pubmed=False, cache_format='parquet', extended_probes=True, distance=None, gencode_basic=False, gencode_primary=False, all_refseq=False, exclude_predicted=False, pick=False, pick_allele=False, per_gene=False, pick_allele_gene=False, flag_pick=False, flag_pick_allele=False, flag_pick_allele_gene=False, pick_order=None, buffer_size=5000, failed=0, cache_size_mb=1024, workers=1, skip_csq=True, plugin_cache_root=None, output_vcf=None, show_progress=True, compression=None, on_batch_written=None)
¶
Annotate variants from a VCF file with VEP consequences.
Reads the VCF, runs annotate_vep() against the partitioned parquet
cache produced by :func:build_cache, and returns a polars LazyFrame.
The engine auto-discovers context tables (transcript, exon, translation,
regulatory, motif) from cache_dir subdirectories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vcf
|
str
|
Path to the input VCF file. |
required |
cache_dir
|
str
|
Path to the parquet cache directory produced by :func: |
required |
everything
|
bool
|
Enable all annotation features (80-field CSQ). Implies |
False
|
hgvs
|
bool
|
Add HGVS notation. Implies |
False
|
hgvsc
|
bool
|
Enable HGVSc notation (implied by |
False
|
hgvsp
|
bool
|
Enable HGVSp notation (implied by |
False
|
shift_hgvs
|
bool or None
|
3' shift HGVS notation. |
None
|
no_escape
|
bool
|
Don't URI-escape HGVS strings. |
False
|
remove_hgvsp_version
|
bool
|
Remove version from HGVSp transcript ID. |
False
|
hgvsp_use_prediction
|
bool
|
Use predicted rather than observed protein sequence. |
False
|
reference_fasta
|
str or None
|
Path to reference FASTA (required for HGVS/everything). |
None
|
check_existing
|
bool
|
Check for co-located known variants (implied by AF flags). |
False
|
af
|
bool
|
Include allele frequencies. |
False
|
af_1kg
|
bool
|
Include 1000 Genomes allele frequencies. |
False
|
af_gnomade
|
bool
|
Include gnomAD exome allele frequencies. |
False
|
af_gnomadg
|
bool
|
Include gnomAD genome allele frequencies. |
False
|
max_af
|
bool
|
Include maximum AF across populations. |
False
|
pubmed
|
bool
|
Include PubMed IDs for co-located variants. |
False
|
extended_probes
|
bool
|
Use interval-overlap fallback for shifted indels (default: True). |
True
|
distance
|
int or tuple[int, int] or None
|
Upstream/downstream distance for transcript overlap. Single int = both directions; tuple = (upstream, downstream). |
None
|
gencode_basic
|
bool
|
Restrict to transcripts in the GENCODE basic set. Mutually exclusive
with |
False
|
gencode_primary
|
bool
|
Restrict to transcripts in the GENCODE primary set (GRCh38 only).
Mutually exclusive with |
False
|
all_refseq
|
bool
|
Keep all RefSeq transcripts including CCDS/EST-style rows. |
False
|
exclude_predicted
|
bool
|
Exclude predicted RefSeq transcripts ( |
False
|
pick
|
bool
|
Emit one selected consequence per variant, matching VEP |
False
|
pick_allele
|
bool
|
Emit one selected consequence per allele, matching VEP
|
False
|
per_gene
|
bool
|
Emit one selected consequence per gene while retaining non-transcript
rows, matching VEP |
False
|
pick_allele_gene
|
bool
|
Emit one selected consequence per allele and gene, matching VEP
|
False
|
flag_pick
|
bool
|
Retain all consequences and add |
False
|
flag_pick_allele
|
bool
|
Retain all consequences and add |
False
|
flag_pick_allele_gene
|
bool
|
Add a standalone |
False
|
pick_order
|
str or None
|
Comma-separated VEP pick ranking order, e.g.
|
None
|
buffer_size
|
int
|
Number of input variants per VEP-style annotation buffer. Defaults to
Ensembl VEP's |
5000
|
failed
|
int
|
Maximum allowed |
0
|
cache_format
|
str
|
Cache format to use. Only |
'parquet'
|
cache_size_mb
|
int
|
Annotation cache size in MB (default: 1024). |
1024
|
workers
|
int
|
Number of within-contig fused annotation pipelines (default: 1).
The single annotation-concurrency knob. |
1
|
skip_csq
|
bool
|
Exclude the raw CSQ column from the output (default: True). When True, only the parsed annotation columns are returned. |
True
|
output_vcf
|
str or None
|
Path to write annotated VCF output. When set, annotation results are
written directly to a VCF file and the output path is returned.
When |
None
|
show_progress
|
bool
|
Show a progress bar on stderr during VCF output (default: True).
Only used when |
True
|
compression
|
str or None
|
VCF output compression. |
None
|
on_batch_written
|
callable or None
|
Callback invoked after each batch is written to VCF, with signature
|
None
|
Returns:
| Type | Description |
|---|---|
LazyFrame or str
|
When |
Examples:
>>> import vepyr
>>> lf = vepyr.annotate("input.vcf", "/data/vep/parquet/115_GRCh38_ensembl")
>>> lf.collect()
>>> # Full annotation with all features
>>> lf = vepyr.annotate(
... "input.vcf",
... "/data/vep/parquet/115_GRCh38_ensembl",
... everything=True,
... reference_fasta="/ref/GRCh38.fa",
... )