plotly / dash-bio

Open-source bioinformatics components for Dash
https://dash-gallery.plotly.host/Portal/?search=Bioinformatics
MIT License
529 stars 194 forks source link

Callbacks of ideogram's brush failing both as input and output elements #682

Open asdrgil-dev opened 2 years ago

asdrgil-dev commented 2 years ago

Describe the bug I cannot use brush data neither as input nor as output of callbacks.

To Reproduce My ideogram code is quite simple. It is as follows:

app = DjangoDash('Example', prevent_initial_callbacks= True)
app.layout = html.Div(children=[
        dashbio.Ideogram(
            id='ideogram-graph',
            chromosomes=["1"],
            orientation='horizontal',
            rotatable=False,
            chrHeight=1400,
            chrWidth=10,
            brush='chr1:1-10000000'
        ),
],  style={'text-align': 'center'})

    @app.callback(
        [Output('ideogram-graph','brush')],
        [Input('ideogram-graph', 'brushData')])
    def update_stuff(brush_data):
        # Do stuff with brush_data

The errors I get on the browser are the following ones:

async-ideogram.js:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'from')
    at n.value (async-ideogram.js:2:233404)
    at SVGGElement.<anonymous> (async-ideogram.js:2:159301)
    at cn.call (async-ideogram.js:2:18785)
    at h.emit (async-ideogram.js:2:52899)
    at h.brush (async-ideogram.js:2:52726)
    at SVGGElement.<anonymous> (async-ideogram.js:2:52420)
    at Lt.each (async-ideogram.js:2:11388)
    at Ur.c.move (async-ideogram.js:2:52235)
    at Lt.call (async-ideogram.js:2:10812)
    at async-ideogram.js:2:159754

Expected behavior Read and write the brush data of the ideogram on the callbacks.

Python version: 3.7

Python environment (all installed packages in your current environment): This is the content of my requirements.txt file:

asyncio==3.4.3
dash==1.20.0
dash-core-components==1.16.0
dash-html-components==1.1.3
dash-renderer==1.9.1
dash-table==4.11.3
dash-bio~=1.0.1
Django==3.2.9
django-plotly-dash==1.6.6
djangorestframework~=3.13.1
django-cors-headers==3.11.0
drf-registration==0.1.3
jsonschema~=4.0.0
mysqlclient~=2.1.0
mysql-connector-python==8.0.28
pandas~=1.1.0
passlib~=1.7.4
plotly==5.4.0
python-dotenv==0.19.2
PyMySQL~=1.0.2
PyJWT~=2.3.0
PyYAML==6.0
django-extensions==3.1.5