GenomeSpy
GenomeSpy is a Python wrapper for the JavaScript visualization grammar library GenomeSpy. It enables the creation of interactive, GPU-accelerated genomic visualizations through a declarative grammar.
The Python package provides a high-level interface to create GenomeSpy visualizations. Under the hood, it:
- Generates JSON specifications that GenomeSpy can interpret
- Creates a temporary HTTP server to serve local data files
- Handles rendering in Jupyter notebooks by creating temporary HTML files
- Supports exporting standalone HTML files for sharing (note: referenced data files must remain accessible)
The javascript (official) version of GenomeSpy is developed in The Systems Biology of Drug Resistance in Cancer group at the University of Helsinki by Kari Lavikka. Original repo is at genome-spy/genome-spy.
Note: This package has been primarily tested with the hg38 (GRCh38) human genome assembly. While it may work with other assemblies, full compatibility is not guaranteed. PRs are welcomed!
Features
- 🚀 GPU-accelerated rendering for fluid interaction with large datasets
- 🧬 Native support for genomic data formats including BigWig, BigBed, and Indexed FASTA
- 📊 Declarative visualization grammar for mapping data to visual channels
- 🔍 Interactive zooming and navigation for exploring genomic regions
- 📱 Responsive design that adapts to different screen sizes
- 🔧 Highly customizable with extensive configuration options
Installation
pip install genomespy
Quick Start
Here's a simple example to get you started:
from genomespy import igv
tracks = {
"ZBTB7A": {
"url": "https://chip-atlas.dbcls.jp/data/hg38/eachData/bw/SRX3161009.bw",
"height": 40,
"type": "bigwig"
}}
plot = igv(tracks, region={"chrom": "chr7", "start": 66600000, "end": 66800000}, server_port=18089)
plot.show()
# plot.close() when you finished visualization
Note: When running on a remote server, you'll need to set up port forwarding to access the visualization locally. The default port is 18089, but this can be customized. In VS Code, you can set up port forwarding by:
- Opening the "PORTS" tab in the bottom panel
- Clicking "Forward a Port"
- Entering port 18089 (or your chosen port)
For other IDEs/environments, consult their documentation on port forwarding.
You can also use genomespy with gradio. Check out the example in example_gradio.py.
Documentation
Comprehensive documentation is available at genomespy.readthedocs.io, including:
- Detailed installation instructions
- API reference
- Usage examples
- Contributing guidelines
Key Concepts
GenomeSpy uses a grammar of graphics approach where visualizations are built by:
- Marks: Basic visual elements (rect, point, line, etc.)
- Encodings: Mappings from data to visual properties
- Scales: Functions that transform data values to visual values
- Transforms: Data transformations and calculations
- Parameters: Dynamic variables for interaction
Development
To contribute to GenomeSpy:
# Clone the repository
git clone https://github.com/fuxialexander/genomespy.git
# Install development dependencies
cd genomespy
pip install -e ".[dev]"
# Run tests
pytest
License
genomespy is distributed under the terms of the MIT license.
Support
Metadata
Release files for genomespy 0.0.7
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 |
|---|---|---|---|---|
| genomespy-0.0.7.tar.gz | 1.3 MB | Without provenance | Details for genomespy-0.0.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| genomespy-0.0.7-py3-none-any.whl | Python 3 | none | any | Details for genomespy-0.0.7-py3-none-any.whl |
Total release size: 2.6 MB
Release files / genomespy-0.0.7.tar.gz
| Download URL | genomespy-0.0.7.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adb99643288ae959782a021141a0668713d1fb6d31a15feaddd49a3245f759a6
|
|
BLAKE2b-256 checksum How to use checksums |
9929ad17aeaa5e7688dcced78c4179bb44b2363c934dfdd6b53779b69d34f7f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / genomespy-0.0.7-py3-none-any.whl
| Download URL | genomespy-0.0.7-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0bc5200ca0f54f04c7090b26e3d6f49e55cad5dcb3232c13cc35f554e73073e
|
|
BLAKE2b-256 checksum How to use checksums |
d6573047b4984c1ff56c84505d79ddf19344cd999f473f38e346c9fe2ce46877
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Security for genomespy 0.0.7
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.