varcode
Variant annotation in Python
What it is and what it does
Varcode is a Python library for working with genomic variant data and predicting the impact of those variants on protein sequences. It loads variants from standard formats like MAF files, organizes them by gene, and computes detailed mutation effects—such as amino acid substitutions, frameshifts, premature stops, and splice disruptions—on each affected transcript. The library represents effects as typed objects (e.g., `Substitution`, `FrameShift`, `PrematureStop`) that expose the mutant protein sequence, the transcript involved, and the gene context.
The package is built on numpy, pandas, and pyensembl for reference genome lookups. It handles complex scenarios like multi-outcome effects (where a variant's impact is ambiguous without additional information), structural variants, and germline-aware annotation. Users typically load variant collections, filter or group by gene, call `.effects()` to compute annotations, and inspect the resulting effect objects for downstream analysis—such as identifying driver mutations, predicting immunogenicity, or prioritizing variants for experimental validation.
Use it for:
- Load TCGA or other cancer variant datasets and predict which mutations cause protein-truncating effects like premature stops or frameshifts.
- Annotate somatic variants in a tumor sample to identify which genes are affected and classify each variant's functional impact.
- Group variants by gene and compute effects across all transcripts to understand isoform-specific consequences of the same mutation.
- Filter variant collections for high-priority effects (e.g., nonsense mutations) to prioritize candidates for experimental validation or clinical reporting.
- Analyze multi-sample VCF files with per-sample genotype information to classify variants as somatic or germline and compute sample-aware effects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Varcode loads and analyzes genomic variant data, predicting how DNA variants affect protein sequences by annotating their biological effects on genes and transcripts.
Yes. Varcode is actively maintained, has low install friction, carries a permissive license, and fills a specific niche in genomic variant annotation. It is well-suited for researchers and bioinformaticians working with variant data who need reliable effect prediction. Requires Python ≥3.9 and a one-time setup of reference genome data via pyensembl; no known security vulnerabilities.
Install
varcode on PyPI
pip
pip install varcodeuv
uv add varcodepoetry
poetry add varcodeInstalling varcode
Before you install
Low install friction with a pure-Python wheel. Active maintenance as of 2026-07-09 with recent release (36 days old). Depends on numpy, pandas, and pyensembl; requires reference genome data installed separately via pyensembl.
License in practice
Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install varcode
pyensembl install --release 75
import varcode
variants = varcode.load_maf("variants.maf")
effects = variants.effects()
print(effects[0])
Requires reference genome data installed via pyensembl (e.g., `pyensembl install --release 75 76`) before variant effects can be computed.
Verify before relying
- Whether pyensembl reference data download and setup is straightforward for first-time users
- Performance characteristics with large variant sets (e.g., whole-genome or multi-sample VCFs)
- Completeness of effect annotation coverage across all variant types and edge cases
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — numpy, pandas, pyensembl, memoized_property, serializable, sercol |
| Maintenance | actively maintained — 36 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 96,701/month — #13,199 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: varcode-7.0.0-py3-none-any.whl
Tags
More Bio-Informatics packages
NetworkX provides data structures and…
permissive · top 1,000 on PyPI
biopythonBiopython provides Python tools for…
unclear · top 5,000 on PyPI
firecrawl-pyClient library for the Firecrawl API that…
permissive · top 5,000 on PyPI
intervaltreeA self-balancing interval tree data structure…
permissive · top 5,000 on PyPI
albumentationsAlbumentations applies image transformations to…
permissive · top 5,000 on PyPI
PubChemPyPubChemPy is a Python wrapper around the…
permissive · top 5,000 on PyPI
biothings-clientbiothings_client provides Python wrappers to…
permissive · top 5,000 on PyPI
gtfparseParses GTF (gene transfer format) files into…
permissive · top 15,000 on PyPI
pyensemblPyEnsembl provides a Python interface to query…
permissive · top 15,000 on PyPI
bx-pythonbx-python provides Python classes and utilities…
permissive · top 15,000 on PyPI
RUSTRUST normalizes ribosome profiling (Ribo-seq)…
permissive · top 15,000 on PyPI
logomakerLogomaker creates customized sequence…
permissive · top 15,000 on PyPI
pyhmmerPyHMMER provides Python bindings to HMMER3, a…
permissive · top 5,000 on PyPI
mhctoolsUnified Python interface to multiple MHC…
permissive · top 15,000 on PyPI
mutmutMutmut is a mutation testing system for Python…
permissive · top 5,000 on PyPI
cosmic-rayCosmic Ray is a mutation testing tool that…
permissive · top 15,000 on PyPI