Skip to main content

Python bindings to generate gosling schema.

Project description

ipygosling

Here be dragons 🐉

This is an experimental project that is planned to merge with gosling.py. Feedback is much appreciated and most welcomed. Please use with caution.

Installation

pip install -e .

Generate source code (you should not need to run these steps)

The schema bindings (gosling/schema) and JS static assets (gosling/static/) are automatically generated using the following scripts. Please do not edit these files directly.

Python schema bindings

python tools/generate_schema_wrapper.py # generates gosling/schema/*

JavScript Jupyter extension/widget

yarn install && yarn build # generates gosling/static/{widget.js, index.js}

# Only run this if using gos.GoslingWidget
jupyter nbextension install --py --symlink --overwrite --sys-prefix gosling
jupyter nbextension enable gosling --py --sys-prefix

Usage

import gosling as gos

data = gos.Data(
    url="https://resgen.io/api/v1/tileset_info/?d=UvVPeLHuRDiYA3qwFlm7xQ",
    type="multivec",
    row="sample",
    column="position",
    value="peak",
    categories=["sample 1"],
    binSize=5,
)

track = gos.Track(data=data, layout="linear").mark_bar().encode(
    y="peak:Q",
    x="start:G",
    xe="end:G",
    stroke=gos.Channel(value=0.5),
    strokeWidth=gos.Channel(value=0.5),
).properties(width=180)

spec = track.chart(title="Basic Marks: Bar", subtitle="Tutorial Examples")

print(spec.to_json())

# {
#   "subtitle": "Tutorial Examples",
#   "title": "Basic Marks: Bar",
#   "tracks": [
#     {
#       "data": {
#         "binSize": 5,
#         "categories": [
#           "sample 1"
#         ],
#         "column": "position",
#         "row": "sample",
#         "type": "multivec",
#         "url": "https://resgen.io/api/v1/tileset_info/?d=UvVPeLHuRDiYA3qwFlm7xQ",
#         "value": "peak"
#       },
#       "height": 180,
#       "layout": "linear",
#       "mark": "bar",
#       "stroke": {
#         "value": 0.5
#       },
#       "strokeWidth": {
#         "value": 0.5
#       },
#       "width": 180,
#       "x": {
#         "field": "start",
#         "type": "genomic"
#       },
#       "xe": {
#         "field": "end",
#         "type": "genomic"
#       },
#       "y": {
#         "field": "peak",
#         "type": "quantitative"
#       }
#     }
#   ]
# }
spec # render spec in jupyter cell!
widget = gos.GoslingWidget(spec) # create widget
widget.spec = new_spec # update view

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gosling-0.0.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

gosling-0.0.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file gosling-0.0.0.tar.gz.

File metadata

  • Download URL: gosling-0.0.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for gosling-0.0.0.tar.gz
Algorithm Hash digest
SHA256 c219727ff995e93cdc557db1c09c1c6d683e0dd0419fecc3d8761df8da88cc92
MD5 f3b01e12566ba0d59f8a49f8a254cdef
BLAKE2b-256 cc4bbfe9ef28a81e5c8292dd5332daa3f04c7ee3f362cffe4271ba8146a365a2

See more details on using hashes here.

File details

Details for the file gosling-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: gosling-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for gosling-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ed5a06f8358159ee7c0ba6fc09330d9a036399a435c77abc53b3608d94c614f
MD5 7cfe38c3a227796fc307332ba9c6a684
BLAKE2b-256 aad2a0b2c8c0f39077d19312b66b2946ed2b8e57532017d44b7010f75d26e2b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page