Python bindings to generate Gosling visualizations
Project description
gos 🦆
gos is a declarative genomics visualization library for Python. It is built on top of the Gosling JSON specification, providing a simplified interface for authoring interactive genomic visualizations.
Installation
The gos API is under active development. Feedback is appreciated and welcomed.
pip install gosling[all]
Documentation
See the Documentation Site for more information.
Example
import gosling as gos
data = gos.multivec(
url="https://server.gosling-lang.org/api/v1/tileset_info/?d=cistrome-multivec",
row="sample",
column="position",
value="peak",
categories=["sample 1", "sample 2", "sample 3", "sample 4"],
binSize=5,
)
base_track = gos.Track(data, width=800, height=100)
heatmap = base_track.mark_rect().encode(
x=gos.X("start:G", axis="top"),
xe="end:G",
row=gos.Row("sample:N", legend=True),
color=gos.Color("peak:Q", legend=True),
)
bars = base_track.mark_bar().encode(
x=gos.X("position:G", axis="top"),
y="peak:Q",
row="sample:N",
color=gos.Color("sample:N", legend=True),
)
lines = base_track.mark_line().encode(
x=gos.X("position:G", axis="top"),
y="peak:Q",
row="sample:N",
color=gos.Color("sample:N", legend=True),
)
gos.vertical(heatmap, bars, lines).properties(
title="Visual Encoding",
subtitle="Gosling provides diverse visual encoding methods",
layout="linear",
centerRadius=0.8,
xDomain=gos.GenomicDomain(chromosome="1", interval=[1, 3000500]),
)
Example Gallery
We have started a gallery of
community examples in gosling/examples/
. If you are interested in contributing, please
feel free to submit a PR! Checkout the existing JSON examples
if you are looking for inspiration.
Development
pip install -e '.[dev]'
The schema bindings (gosling/schema/
) and docs (doc/user_guide/API.rst
) are
automatically generated using the following. Please do not edit these
files directly.
# generate gosling/schema/*
python tools/generate_schema_wrapper.py <tag_name>
Release
git checkout main && git pull
git commit -m "v0.[minor].[patch]"
git tag -a v0.[minor].[patch] -m "v0.[minor].[patch]"
git push --follow-tags
Design & Implementation
gos is inspired by and borrows heavily from Altair both in project philosophy
and implementation. The internal Python API is auto-generated from the
Gosling specification using code adapted directly from Altair to generate
Vega-Lite bindings. This design choice guarantees that visualizations are
type-checked in complete concordance with the Gosling specification, and that
the Python API remains consistent with the evolving schema over time. Special thanks to
Jake Vanderplas and others on
schemapi
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gosling-0.2.0.tar.gz
.
File metadata
- Download URL: gosling-0.2.0.tar.gz
- Upload date:
- Size: 70.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8383d335ce9561f02aa42beebaf9a5232a2f95125957990254e51a1af34df6a0 |
|
MD5 | 519a7637c78a9d3af3426fc7c65061a7 |
|
BLAKE2b-256 | 4982671957eed6fd389e53ca146f165a304b1e1470dfe1bf7863134c80bd08f1 |
File details
Details for the file gosling-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: gosling-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 87.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bd1879c5efc628f556525e64e1c6351d2ff62aeb7440f1bb0a6666aaf056f05 |
|
MD5 | dd874b8405d266b1e968a5d4c4223989 |
|
BLAKE2b-256 | 79399bcc22cb846c9b5c8f12fef43b168a528dc408ed1bb5c3a0e46afe801dad |