Skip to content

Commit 922b4be

Browse files
author
xhlulu
committed
Add linting
Former-commit-id: 1fca636
1 parent 9c27b93 commit 922b4be

File tree

1 file changed

+35
-37
lines changed

1 file changed

+35
-37
lines changed

apps/dash-pileup-demo/app.py

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414

1515
_COMPONENT_ID = "pileup-browser"
1616

17+
1718
def description():
1819
return "An interactive in-browser track viewer."
1920

2021

2122
def azure_url(file):
22-
return os.path.join("https://sampleappsdata.blob.core.windows.net/dash-pileup-demo/rna/", file)
23+
return os.path.join(
24+
"https://sampleappsdata.blob.core.windows.net/dash-pileup-demo/rna/", file
25+
)
2326

2427

2528
def header_colors():
@@ -42,17 +45,15 @@ def rna_differential(app):
4245
}
4346

4447
HOSTED_TRACKS = {
45-
'range': {"contig": "chr1", "start": 54986297, "stop": 54991347},
46-
'celltype': [
48+
"range": {"contig": "chr1", "start": 54986297, "stop": 54991347},
49+
"celltype": [
4750
{"viz": "scale", "label": "Scale"},
4851
{"viz": "location", "label": "Location"},
4952
{
5053
"viz": "genes",
5154
"label": "genes",
5255
"source": "bigBed",
53-
"sourceOptions": {
54-
"url": azure_url("mm10.ncbiRefSeq.sorted.bb")
55-
},
56+
"sourceOptions": {"url": azure_url("mm10.ncbiRefSeq.sorted.bb")},
5657
},
5758
{
5859
"viz": "coverage",
@@ -79,7 +80,7 @@ def rna_differential(app):
7980
"source": "bam",
8081
"sourceOptions": luminal_lactate,
8182
},
82-
]
83+
],
8384
}
8485

8586
return HOSTED_TRACKS
@@ -95,15 +96,17 @@ def rna_differential(app):
9596
# Differentially expressed genes (identified in R, see assets/data/rna/README.md)
9697
DE_dataframe = pd.read_csv(azure_url("DE_genes.csv"))
9798
# filter for the cell type condition
98-
DE_dataframe = DE_dataframe[DE_dataframe['Comparison'] == "luminal__v__basal"].reset_index()
99+
DE_dataframe = DE_dataframe[
100+
DE_dataframe["Comparison"] == "luminal__v__basal"
101+
].reset_index()
99102

100103
# add SNP column
101104
DE_dataframe["SNP"] = "NA"
102105

103106

104107
# get min and max effect sizes
105-
df_min = math.floor(min(DE_dataframe['log2FoldChange']))
106-
df_max = math.ceil(max(DE_dataframe['log2FoldChange']))
108+
df_min = math.floor(min(DE_dataframe["log2FoldChange"]))
109+
df_max = math.ceil(max(DE_dataframe["log2FoldChange"]))
107110

108111

109112
def layout(app):
@@ -127,38 +130,39 @@ def layout(app):
127130
children=html.Div(
128131
className="control-tab",
129132
children=[
130-
'Effect Size',
133+
"Effect Size",
131134
dcc.RangeSlider(
132-
id='pileup-volcanoplot-input',
135+
id="pileup-volcanoplot-input",
133136
min=df_min,
134137
max=df_max,
135138
step=None,
136139
marks={
137-
i: {'label': str(i)} for i in range(df_min, df_max+1, 2)
140+
i: {"label": str(i)}
141+
for i in range(df_min, df_max + 1, 2)
138142
},
139-
value=[-1,1]
143+
value=[-1, 1],
140144
),
141145
html.Br(),
142146
dcc.Graph(
143147
id="pileup-dashbio-volcanoplot",
144148
figure=dash_bio.VolcanoPlot(
145149
dataframe=DE_dataframe,
146-
margin=go.layout.Margin(l = 0,r = 0, b = 0),
147-
legend= {
148-
'orientation': 'h',
149-
'yanchor': 'bottom',
150-
'y' : 1.02,
151-
'bgcolor': '#f2f5fa'
150+
margin=go.layout.Margin(l=0, r=0, b=0),
151+
legend={
152+
"orientation": "h",
153+
"yanchor": "bottom",
154+
"y": 1.02,
155+
"bgcolor": "#f2f5fa",
152156
},
153157
effect_size="log2FoldChange",
154-
effect_size_line = [-1,1],
158+
effect_size_line=[-1, 1],
155159
title="Differentially Expressed Genes",
156160
genomewideline_value=-np.log10(0.05),
157161
p="padj",
158162
snp="SNP",
159163
gene="Gene",
160164
),
161-
)
165+
),
162166
],
163167
),
164168
),
@@ -214,32 +218,26 @@ def callbacks(_app):
214218
HOSTED_CASE_DICT = rna_differential(_app)
215219

216220
@_app.callback(
217-
Output('pileup-dashbio-volcanoplot', 'figure'),
218-
[Input('pileup-volcanoplot-input', 'value')]
221+
Output("pileup-dashbio-volcanoplot", "figure"),
222+
[Input("pileup-volcanoplot-input", "value")],
219223
)
220224
def update_volcano(effects):
221225

222226
return dash_bio.VolcanoPlot(
223227
dataframe=DE_dataframe,
224-
margin=go.layout.Margin(l = 0,r = 0, b = 0),
225-
legend= {
226-
'orientation': 'h',
227-
'yanchor': 'bottom',
228-
'y' : 1.02,
229-
'x': 0.,
230-
},
231-
effect_size='log2FoldChange',
228+
margin=go.layout.Margin(l=0, r=0, b=0),
229+
legend={"orientation": "h", "yanchor": "bottom", "y": 1.02, "x": 0.0,},
230+
effect_size="log2FoldChange",
232231
effect_size_line=effects,
233232
title="Differentially Expressed Genes",
234233
genomewideline_value=-np.log10(0.05),
235-
p='padj',
236-
snp='SNP',
237-
gene='Gene',
234+
p="padj",
235+
snp="SNP",
236+
gene="Gene",
238237
)
239238

240239
@_app.callback(
241-
Output(_COMPONENT_ID, "range"),
242-
Input("pileup-dashbio-volcanoplot", "clickData")
240+
Output(_COMPONENT_ID, "range"), Input("pileup-dashbio-volcanoplot", "clickData")
243241
)
244242
def update_range(point):
245243

0 commit comments

Comments
 (0)