-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
71 lines (60 loc) · 1.68 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import pandas as pd
import dash
import flask
from dash.dependencies import Input, Output
import dash_bio as dashbio
from dash import html
from dash import dcc
PUBLIC_URL_PREFIX = os.getenv("PUBLIC_URL_PREFIX", "")
SERVER_HOST = os.getenv("SERVER_HOST", "0.0.0.0")
SERVER_PORT = int(os.getenv("SERVER_PORT", "8050"))
DEBUG = {"1": True, "true": True}.get(os.getenv("DEBUG", "0").lower(), False)
#: The Flask application to use.
app_flask = flask.Flask(__name__)
# Setup URL prefix for Flask.
app_flask.config["APPLICATION_ROOT"] = "%s/" % PUBLIC_URL_PREFIX
#: The Dash application to run.
app = dash.Dash(
__name__,
# Use our specific Flask app
server=app_flask,
# The visualization will be served below "/dash"
requests_pathname_prefix="%s/" % PUBLIC_URL_PREFIX,
)
df = pd.read_csv(
'https://raw.githubusercontent.com/plotly/dash-bio-docs-files/master/' +
'manhattan_data.csv'
)
app.layout = html.Div([
'Threshold value',
dcc.Slider(
id='default-manhattanplot-input',
min=1,
max=10,
marks={
i: {'label': str(i)} for i in range(10)
},
value=6
),
html.Br(),
html.Div(
dcc.Graph(
id='default-dashbio-manhattanplot',
figure=dashbio.ManhattanPlot(
dataframe=df
)
)
)
])
@app.callback(
Output('default-dashbio-manhattanplot', 'figure'),
Input('default-manhattanplot-input', 'value')
)
def update_manhattanplot(threshold):
return dashbio.ManhattanPlot(
dataframe=df,
genomewideline_value=threshold
)
if __name__ == "__main__":
app.run_server(host=SERVER_HOST, port=SERVER_PORT, debug=DEBUG)