#!/usr/bin/env python # coding: utf-8 # In[1]: from dash import html, Dash from dash.dependencies import Input, Output from dash import dcc from jupyter_dash import JupyterDash from jbrowse_jupyter import create, create_component # In[2]: app = JupyterDash(__name__) server = app.server # In[3]: locations = [ {"value": "17:41,196,332..41,277,401", "label": "BRCA1" }, {"value": "13:32,889,615..32,974,375", "label": "BRCA2"}, ] # In[4]: # Return the component with a specific location. @app.callback( Output("default-container", "children"), Input("location-to-view", "value") ) def return_jbrowse(location): print(location) conf = create("view", genome="hg19") conf.set_location(location) return create_component(conf.get_config()) # In[5]: app.layout = html.Div( [ html.P("Select a location to view."), dcc.Dropdown( id="location-to-view", options=locations, value="1:1..90" ), html.Hr(), dcc.Loading(id="default-container"), ] ) # In[6]: app.run_server(mode="inline", use_reloader=False, debug=True, port=3039) # In[ ]: