Gosling custom component for Streamlit
Project description
Streamlit - Gosling
A Streamlit component to display Genomic Visualization using Gosling.
Install
pip install streamlit-gosling
Usage
import streamlit as st
import gosling as gos
from streamlit_gosling import streamlit_gosling as st_gos
size = 500
data = gos.matrix("https://server.gosling-lang.org/api/v1/tileset_info/?d=leung2015-hg38")
# data = gos.matrix('/path/to/dataset.cool') # local dataset
@st.cache
def chart():
return gos.Track(data).mark_bar().encode(
x=gos.X("xs:G", axis="bottom"),
xe="xe:G",
y=gos.Y("ys:G", axis="left"),
ye="ye:G",
color=gos.Color("value:Q", range="hot", legend=True),
).properties(width=size, height=size).view()
st_gos(spec=chart(), id='id', height=size+ 100)
API
st_echarts API
st_gos(
id: string,
spec: a gosling visualization object
height: number
)
Development
Install
- JS side
cd frontend
npm install
- Python side
conda create -n streamlit-gosling python=3.7
conda activate streamlit-gosling
pip install -e .
Run
You need to run both the JS side and the Python side for development mode.
- JS side
cd frontend
npm run start
- Python side
Demo example is on https://github.com/andfanilo/streamlit-echarts-demo.
git clone https://github.com/andfanilo/streamlit-echarts-demo
cd streamlit-echarts-demo/
streamlit run app.py
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
Close
Hashes for streamlit_gosling-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33bc29787c18f47d35924e057dcad86de8fee64188238742a4705e4cdd1639d0 |
|
MD5 | bb7f30006ee69c94f006c76ea9fe03de |
|
BLAKE2b-256 | 3603a931b6373f1211e1850c34857dda4d0493b4e3e820c2ef0213e066af049f |