Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help render Dash components as ipywidgets #158

Open
ddkrutkin opened this issue Sep 5, 2024 · 0 comments
Open

Help render Dash components as ipywidgets #158

ddkrutkin opened this issue Sep 5, 2024 · 0 comments

Comments

@ddkrutkin
Copy link

ddkrutkin commented Sep 5, 2024

  • shinywidgets version: v0.3.2
  • Python version: v3.11.9
  • Operating System: Unix

Description

Hello, thank you for developing Shiny for Python. One of the easiest and development user-friendly data analytics tools available

I am trying to render a Dash component from the dash_bio suite. Specifically, for bioinformatics analyses, rendering an ideogram within a shiny app. I don't have any issues rendering and outputting Plotly figures.

From my understanding, Dash-specific visualizations should be able to be rendered as an ipywidget. The documentation for dash-bio explains that it could be run in a jupyter environment:
https://github.com/plotly/dash-bio

ipywidgets version: 8.1.3
jupyter-dash version: 0.4.2

What I Did

I set up a simple Shiny app to attempt to output the ideogram, but received the following error:
Don't know how to coerce Ideogram(id='ideogram-annotations', annotationsPath='https://eweitz.github.io/ideogram/data/annotations/SRR562646.json', chromosomes=['X', 'Y']) into a ipywidget.Widget object.

import dash_bio as dashbio
from shiny import App, ui
from shinywidgets import render_widget, output_widget

app_ui = ui.page_navbar(
    ui.nav_panel(
        "Test",
        ui.layout_sidebar(
            ui.sidebar(),
            output_widget("ideogram_test")
        ),
    ),
    fillable=True
)

def server(input, output, session):
    @render_widget
    def ideogram_test():
        ideogram = dashbio.Ideogram(
            id='ideogram-annotations',
            chromosomes=['X', 'Y'],
            annotationsPath='https://eweitz.github.io/ideogram/data/annotations/SRR562646.json'
        )
        return ideogram

app = App(app_ui, server)

if __name__ == '__main__':
    app.run()

Thank you for any help and suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant