!pip install git+https://github.com/GMOD/jbrowse-jupyter.git@main
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
app = JupyterDash(__name__)
server = app.server
locations = [
{"value": "17:41,196,332..41,277,401", "label": "BRCA1"
},
{"value": "13:32,889,615..32,974,375", "label": "BRCA2"},
]
# 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())
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"),
]
)
app.run_server(mode="inline", use_reloader=False, debug=True, port=3039)