mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/cief-dashboard.git
synced 2026-08-22 05:54:06 +00:00
56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
import json
|
|
import six.moves.urllib.request as urlreq
|
|
from six import PY3
|
|
|
|
import dash
|
|
import dash_bio as dashbio
|
|
import dash_html_components as html
|
|
import dash_core_components as dcc
|
|
|
|
|
|
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
|
|
|
|
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
|
|
|
|
data = urlreq.urlopen(
|
|
'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/' +
|
|
'circos_graph_data.json'
|
|
).read()
|
|
|
|
if PY3:
|
|
data = data.decode('utf-8')
|
|
|
|
circos_graph_data = json.loads(data)
|
|
|
|
layout = html.Div([
|
|
dashbio.Circos(
|
|
id='my-dashbio-circos',
|
|
layout=circos_graph_data['GRCh37'],
|
|
selectEvent={"0": "hover", "1": "click", "2": "both"},
|
|
tracks=[{
|
|
'type': 'CHORDS',
|
|
'data': circos_graph_data['chords'],
|
|
'config': {
|
|
'tooltipContent': {
|
|
'source': 'source',
|
|
'sourceID': 'id',
|
|
'target': 'target',
|
|
'targetID': 'id',
|
|
'targetEnd': 'end'
|
|
}
|
|
}
|
|
}]
|
|
),
|
|
"Graph type:",
|
|
dcc.Dropdown(
|
|
id='histogram-chords',
|
|
options=[
|
|
{'label': x, 'value': x}
|
|
for x in ['histogram', 'chords']
|
|
],
|
|
value='chords'
|
|
),
|
|
"Event data:",
|
|
html.Div(id='circos-output')
|
|
])
|