VARGRAM (Visual ARrays for GRaphical Analysis of Mutations)
🧬 VARGRAM is a Python package that makes it easy to generate insightful figures for genomic surveillance, born out of our experience during the COVID-19 pandemic. Currently, VARGRAM supports generating mutation profiles straight from sequence files by hooking into existing tools such as Nextclade. The figures can be easily customized within a Python script or Jupyter notebook using a declarative syntax.
🔥 We are actively developing VARGRAM into a full visualization library for common use cases in molecular epidemiology. More modules will be added in the coming months. If you have a feature request or find a bug, please submit an issue.
Documentation
Full installation instructions and tutorials are available on the VARGRAM documentation website.
Installation
Install with pip:
pip install vargram
Python version ≥3.11 is required.
VARGRAM relies on Nextclade to perform mutation calling when sequence files are provided. Make sure to download the Nextclade CLI and add it to the path. You may also just provide Nextclade's analysis CSV output directly and VARGRAM can still produce a mutation profile without Nextclade installed.
Quickstart Guide
To produce a mutation profile, VARGRAM requires a single FASTA file (or a directory of FASTA files) of samples, a FASTA file for the reference, and a genome annotation file following the GFF3 format.
A mutation profile can be generated in just four lines of code:
from vargram import vargram # Importing the package
vg = vargram(seq='path/to/<samples-directory>', # Provide sample sequences
ref='path/to/<reference.fa>', # Provide reference sequence
gene='path/to/<annotation.gff>') # Provide genome annotation
vg.profile() # Tell VARGRAM you want to create a mutation profile
vg.show() # And show the resulting figure
Alternatively, you can simply provide a CSV file. For example, you can upload your sequences to the Nextclade web app and download the analysis CSV output. VARGRAM recognizes this output and can process it:
from vargram import vargram
vg = vargram(data='path/to/<nextclade_analysis.csv>') # Provide Nextclade analysis file
vg.profile()
vg.show()
Calling the mutation profile this way does not require Nextclade CLI to be installed.
Sample Output
Install VARGRAM and try out the following snippet, which will download test data for you. Nextclade CLI does not need to be installed for the following example:
# Import main VARGRAM module and module to download external data
from vargram import vargram
from vargram.data import example
# Download test data into test_data directory
example.get('test_data')
# Generate the mutation profile
vg = vargram(data='test_data/analysis/omicron_analysis_cli.tsv') # Provide data
vg.profile() # Tell VARGRAM you want to create a mutation profile
vg.show() # Show the figure
vg.save("default_profile.png", dpi=300) # Save the figure
This will produce the following figure:
Note that by default, VARGRAM favors placing genes with the most number of mutations first. The figure can be customized to show genes by their start position, to force a horizontal layout and other options:
vg = vargram(data='test_data/analysis/omicron_analysis_cli.tsv', # Provide data
gene='test_data/sc2.gff') # Provide annotation file
vg.profile(threshold=5, # Set minimum count for a mutation to be included
ytype='counts') # Set y-axis to show raw count
vg.aes(stack_title='Region', # Change batch legend title
stack_label=['Foreign', 'Local'], # Change batch names
stack_color=['#009193', '#E33E84'], # Change batch bar colors
order=True, # Order the genes based on the annotation file
flat=True) # Force a horizontal layout
vg.key('test_data/keys/BA1_key.csv', label='BA.1') # Show key mutations of BA.1
vg.key('test_data/keys/BA2_key.csv', label='BA.2') # Show key mutations of BA.2
vg.show() # Show the figure
This results to the following figure:
Metadata
Release files for vargram 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vargram-0.4.0.tar.gz | 31.5 kB | Without provenance | Details for vargram-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vargram-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for vargram-0.4.0-py3-none-any.whl |
Total release size: 62.7 kB
Release files / vargram-0.4.0.tar.gz
| Download URL | vargram-0.4.0.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36bf9c23f242b37642a27fa7ab1952f18c49e2416b6ffba76bd8e414fabac001
|
|
BLAKE2b-256 checksum How to use checksums |
f1dafda526ae6638d07c90498a2f947892923c4bfaa541875c2139307f3646d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / vargram-0.4.0-py3-none-any.whl
| Download URL | vargram-0.4.0-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4365ce52bc1704a008e65332fce5bb0c900a122c65548f6865b2821975c88bfb
|
|
BLAKE2b-256 checksum How to use checksums |
b03f24665e80c8b8bb821eb3f6682f824cc7e6fa7fb6e0657690b87d04463775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for vargram 0.4.0
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.