Skip to main content

Tests Coverage Status PyPI PyPI downloads

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.

Installation

Requires Python 3.11 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.
  • None means 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. Guides by topic:

  • Effect annotation: SNVs, indels, and multi-base substitutions, classified as coding changes (substitution, frameshift, premature stop, ...) or by location (UTR, intron, splice site, intergenic).
  • Splice variants: 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: transcript consequences and gene-fusion candidates for deletions, duplications, inversions, and breakends.
  • Germline, phasing, and observed RNA: optional patient context that refines predictions.
  • Sample queries and identity checks: select a sample's variants, or screen a cohort for possible sample mix-ups.
  • Saving results: CSV, JSON, and VCF export, and what each keeps.
  • Reference ORF consequences: install varcode[orf] and pass extra_orfs="all" (or an evidence name such as "ms" or "immunopeptidomics", or an ORFdata rule) to variant.effects for ordinary and additional coding consequences together, using ORFdata's ORFs for the variant's genome; a catalogue or bound ORFs also work. Access the reference through effect.orf and native outcomes through effect.orf_annotation.

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. Varcode is released under the Apache 2.0 license.

Metadata

Release files for varcode 10.22.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for varcode 10.22.3
File Size Uploaded Provenance Actions
varcode-10.22.3.tar.gz 14.8 MB Without provenance Details for varcode-10.22.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for varcode 10.22.3
File Interpreter ABI Platform Actions
varcode-10.22.3-py3-none-any.whl Python 3 none any Details for varcode-10.22.3-py3-none-any.whl

Total release size: 15.2 MB

Release files / varcode-10.22.3.tar.gz

Download URL varcode-10.22.3.tar.gz
Size 14.8 MB
Tags Source
SHA-256 checksum
How to use checksums
ac5124ed0c8232d498f9b7d98b148d224943a94e7c859a413e76d92a202c7b6d
BLAKE2b-256 checksum
How to use checksums
5e2533758255c798c70be163ffe7aa4e84e74e8db60e577643e9e167f88e9afb
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.22.3-py3-none-any.whl

Download URL varcode-10.22.3-py3-none-any.whl
Size 364.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cce80a37d668f20ca547bb08e79a0a0853fb6ebd3d613b87ed4305f1e188b218
BLAKE2b-256 checksum
How to use checksums
1e9ab1b05376db2266166f7dfe9bc1a98e540a1ee03a7350f6e4f2ca7bd45247
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for varcode 10.22.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

10.22.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page