Registry / devops / varcode

varcode

JSON →
library6.0.0pypypi✓ verified 85d ago

Varcode is a Python library for variant annotation, providing tools to annotate genomic variants with predicted coding effects, such as amino acid changes, splice sites, and more. Current version is 6.0.0, requiring Python ≥3.9. It is part of the OpenVax project and follows a regular release cycle.

pip install varcode
INSTALL
IMPORT
SIG · VARCODE
V
varcode
devopspythonv6.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Variant
from varcode import Variant
import varcode; varcode.Variant
Direct import is more straightforward.
VariantCollection
from varcode import VariantCollection
ProteinSequence
from varcode import ProteinSequence

A minimal example: create a single variant and retrieve its predicted coding effect and protein change.

from varcode import Variant from pyensembl import EnsemblRelease # Load reference genome (first time downloads data) ensembl = EnsemblRelease(75) # Create a variant: chromosome, position, ref, alt variant = Variant('1', 123456, 'A', 'T', ensembl=ensembl) # Annotate the variant effect = variant.effect() print(effect) # Get predicted protein change protein_change = variant.protein_change() print(protein_change)
Debug
Known issues
breakingVarcode v6.0.0 dropped support for Python 2.7 and Python 3.5-3.8. Requires Python >=3.9.
fix
Upgrade Python to 3.9 or later. If stuck on older Python, use varcode <=5.0.x.
affects: >=6.0.0
deprecatedThe `Variant.effect()` method may return complex effect objects; prefer using `variant.effect().short_description` for a simple string.
fix
Use `str(variant.effect())` or `variant.effect().short_description` instead of relying on the default __repr__.
affects: all
gotchaGenome data is downloaded automatically by PyEnsembl the first time you use a release. This can be slow and requires internet. For offline use, pre-download with `pyensembl install --release <number>`.
fix
Run `pyensembl install --release 75` (or your desired release) offline.
affects: all
gotchaVariant positions are 1-based. Using 0-based coordinates from other tools (e.g., BED) will produce incorrect annotations.
fix
Always use 1-based positions as per VCF convention.
affects: all
breakingThe `annotate` module and `VariantAnnotationResult` class were removed or refactored in v6.0.0. Code using `from varcode.annotate import ...` will break.
fix
Use `Variant.effect()` and `Variant.protein_change()` directly. Replace `VariantAnnotationResult` with `VariantEffect`.
affects: >=6.0.0
Errors
Common errors & fixes
ImportError: No module named pyensembl
PyEnsembl is not installed, or the environment is missing the dependency.
fix
Install pyensembl: `pip install pyensembl`
ValueError: Genome release 75 not found. Please install it using: pyensembl install --release 75
The required Ensembl release data has not been downloaded.
fix
Run `pyensembl install --release 75` (or the release you need) in your terminal.
AttributeError: 'Variant' object has no attribute 'effect'
The varcode version is too old (<5.0) or the import path is wrong (e.g., using varcode.Variant instead of direct import).
fix
Update varcode: `pip install --upgrade varcode`. Use `from varcode import Variant`.
Upgrade
Version history
6.0.0latest on PyPI · released May 26, 2026
Audit
Dependencies
pyensemblrequiredRequired for genome assemblies and gene annotations.
pandasrequiredUsed for data manipulation and output.
numpyrequiredUsed for numerical operations.
pyvcfoptionalFor reading VCF files (optional but common).
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
varcode — pip install varcode · libregistry