Varcode
Varcode is a Python library that predicts what genomic variants do to genes,
transcripts, and proteins. Load a VCF or MAF file, and for each variant on each
overlapping transcript, Varcode reports the predicted consequence (for example
a substitution such as p.L159M, a frameshift, or a gene fusion). Where the
sequence can be determined, it also gives the mutant protein.
What it does
- Small variants: SNVs, indels, and multi-base substitutions are classified as coding changes (substitution, frameshift, premature stop, and others) or by where they fall (UTR, intron, splice site, intergenic).
- Splice variants: returns the possible outcomes, such as exon skipping, intron retention, or a cryptic splice site, each with its own predicted protein when it can be determined.
- Structural variants: deletions, duplications, inversions, and breakends get transcript consequences and gene-fusion candidates.
- Patient context (optional): germline variants, phase from a phased VCF or RNA reads, and observed RNA structures refine predictions.
- Sample checks: screens a cohort for possible sample mix-ups using donor genotypes and shared somatic mutations.
Installation
Requires Python 3.9 or later:
pip install varcode
pyensembl install --release 81 --species human
The second command downloads the gene annotation and transcript sequences used in the example below (Ensembl 81, GRCh38). For your own data, choose an annotation that matches your input's genome build; see reference setup.
Quick start
Predict the effect of a single GRCh38 variant on a CFTR transcript:
from varcode import Variant
variant = Variant("7", 117_531_100, "T", "A", genome=81)
transcript = variant.genome.transcript_by_id("ENST00000003084")
effect = variant.effect_on_transcript(transcript)
print(effect.short_description) # p.L159M
protein = effect.mutant_protein_sequence
Annotate every variant in a VCF called against the same genome build, and print the most severe effect for each:
from varcode import load_vcf
variants = load_vcf("variants.vcf", genome=81)
effects = variants.effects()
for variant, effect in effects.top_priority_effect_per_variant().items():
print(variant.short_description, effect.short_description)
Or from the command line:
varcode --genome GRCh38 --vcf variants.vcf --output-csv effects.csv
Reading the results
- One variant, many transcripts. Each prediction belongs to one
transcript, and a variant's effect can differ between transcripts.
top_priority_effect_per_variant()picks one per variant for a summary. - "Top priority" means most severe, not most likely. The ranking is Varcode's ordering of consequence severity. It is not a probability, a pathogenicity score, or a clinical classification.
- Some effects have several possible outcomes. Splice variants, structural variants, and variants with unknown phase keep all their candidate outcomes rather than guessing one.
Nonemeans unknown, not unchanged. A missing protein sequence means Varcode could not determine it.- Predictions are not observations. A predicted protein doesn't show that the transcript or protein is expressed.
Learn more
The documentation starts with a getting-started guide and then covers sample filtering, splice and structural variants, germline and phasing, RNA evidence, and saving results.
Reference pages cover effect types, coordinate conventions, and the API.
Varcode is part of the OpenVax tools. Isovar reconstructs variant sequences from RNA reads, and Vaxrank evaluates the resulting protein/peptide candidates; see how the libraries fit together.
For bugs or questions, open an issue. Contributions are welcome; see CONTRIBUTING.md and the changelog.
Release files for varcode 10.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| varcode-10.2.1.tar.gz | 496.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| varcode-10.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 798.3 kB
Release files / varcode-10.2.1.tar.gz
| Download URL | varcode-10.2.1.tar.gz |
|---|---|
| Size | 496.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d191d1901fe6c9752e8879be3499b8104b44d266ffdf23baa8830189e6f0d47
|
|
BLAKE2b-256 checksum How to use checksums |
9e0989ef0c6a9b083a6286ffe828c691230e450f667412e3055e3556e8b9529c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / varcode-10.2.1-py3-none-any.whl
| Download URL | varcode-10.2.1-py3-none-any.whl |
|---|---|
| Size | 302.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
129896dd8fb1aefbe4829b22a246f639c0fc426d37844eff0f71d10baf35d693
|
|
BLAKE2b-256 checksum How to use checksums |
f5f16a0bfb8c2bd9ac84f3ea8e4ea21f197fc1c708d692442d72c2bb40429447
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|