Spaces:
Sleeping
Sleeping
Update pages/Suture.py
Browse files- pages/Suture.py +33 -33
pages/Suture.py
CHANGED
|
@@ -55,7 +55,7 @@ storage_options={'account_name': AZURE_STORAGE_ACCOUNT, 'account_key': AZURE_STO
|
|
| 55 |
# Load in multiple dataframes
|
| 56 |
df = pl.scan_parquet(f"az://{dataset}.parquet", storage_options=storage_options).collect()
|
| 57 |
|
| 58 |
-
# Create the second tab content with scatter-
|
| 59 |
tab2_content = html.Div([
|
| 60 |
html.Div([
|
| 61 |
html.Label("S-cycle genes"),
|
|
@@ -164,20 +164,20 @@ tab2_content = html.Div([
|
|
| 164 |
]),
|
| 165 |
]),
|
| 166 |
html.Div([
|
| 167 |
-
dcc.Graph(id='scatter-
|
| 168 |
]),
|
| 169 |
html.Div([
|
| 170 |
-
dcc.Graph(id='scatter-
|
| 171 |
]),
|
| 172 |
html.Div([
|
| 173 |
-
dcc.Graph(id='scatter-
|
| 174 |
]),
|
| 175 |
html.Div([
|
| 176 |
-
dcc.Graph(id='scatter-
|
| 177 |
]),
|
| 178 |
])
|
| 179 |
|
| 180 |
-
# Create the second tab content with scatter-
|
| 181 |
tab3_content = html.Div([
|
| 182 |
html.Div([
|
| 183 |
html.Label("UMAP condition 1"),
|
|
@@ -187,16 +187,16 @@ tab3_content = html.Div([
|
|
| 187 |
dcc.Dropdown(id='dpdn6', value="Pax6", multi=False,
|
| 188 |
options=df.columns),
|
| 189 |
html.Div([
|
| 190 |
-
dcc.Graph(id='scatter-
|
| 191 |
]),
|
| 192 |
html.Div([
|
| 193 |
-
dcc.Graph(id='scatter-
|
| 194 |
]),
|
| 195 |
html.Div([
|
| 196 |
-
dcc.Graph(id='scatter-
|
| 197 |
]),
|
| 198 |
html.Div([
|
| 199 |
-
dcc.Graph(id='my-
|
| 200 |
className='four columns',config=config_fig
|
| 201 |
)
|
| 202 |
]),
|
|
@@ -217,7 +217,7 @@ tab4_content = html.Div([
|
|
| 217 |
options=df.columns),
|
| 218 |
]),
|
| 219 |
html.Div([
|
| 220 |
-
dcc.Graph(id='scatter-
|
| 221 |
]),
|
| 222 |
])
|
| 223 |
|
|
@@ -236,15 +236,15 @@ layout = html.Div([
|
|
| 236 |
])
|
| 237 |
|
| 238 |
@callback(
|
| 239 |
-
Output(component_id='scatter-
|
| 240 |
-
Output(component_id='scatter-
|
| 241 |
-
Output(component_id='scatter-
|
| 242 |
-
Output(component_id='scatter-
|
| 243 |
-
Output(component_id='scatter-
|
| 244 |
-
Output(component_id='scatter-
|
| 245 |
-
Output(component_id='scatter-
|
| 246 |
-
Output(component_id='scatter-
|
| 247 |
-
Output(component_id='my-
|
| 248 |
Input(component_id='dpdn2', component_property='value'),
|
| 249 |
Input(component_id='dpdn3', component_property='value'),
|
| 250 |
Input(component_id='dpdn4', component_property='value'),
|
|
@@ -298,53 +298,53 @@ def update_graph_and_pie_chart(col_chosen, s_chosen, g2m_chosen, condition1_chos
|
|
| 298 |
# Final part to join the percentage expressed and mean expression levels
|
| 299 |
expression_means = expression_means.join(dff_5, on=[col_chosen,"Gene"], how="inner")
|
| 300 |
|
| 301 |
-
|
| 302 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 303 |
hover_name=None, title="S-cycle gene:",template="seaborn")
|
| 304 |
|
| 305 |
-
|
| 306 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 307 |
hover_name='condition', title="G2M-cycle gene:",template="seaborn")
|
| 308 |
|
| 309 |
-
|
| 310 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 311 |
hover_name='condition', title="S score:",template="seaborn")
|
| 312 |
|
| 313 |
-
|
| 314 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 315 |
hover_name='condition', title="G2M score:",template="seaborn")
|
| 316 |
|
| 317 |
# Sort values of custom in-between
|
| 318 |
dff = dff.sort(condition1_chosen)
|
| 319 |
|
| 320 |
-
|
| 321 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 322 |
hover_name=None,hover_data = None, template="seaborn",category_orders=cat_ord)
|
| 323 |
-
|
| 324 |
-
|
| 325 |
|
| 326 |
-
|
| 327 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 328 |
hover_name='condition',template="seaborn")
|
| 329 |
|
| 330 |
-
|
| 331 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 332 |
hover_name='condition',template="seaborn",category_orders=cat_ord)
|
| 333 |
|
| 334 |
# Reorder categories on natural sorting or on the integrated cell state order of the paper
|
| 335 |
if col_chosen == "integrated_cell_states":
|
| 336 |
-
|
| 337 |
size="percentage", size_max = 20,
|
| 338 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 339 |
hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique())})
|
| 340 |
else:
|
| 341 |
-
|
| 342 |
size="percentage", size_max = 20,
|
| 343 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 344 |
hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
|
| 345 |
|
| 346 |
-
|
| 347 |
color=condition1_chosen, hover_name=condition1_chosen,template="seaborn",category_orders=cat_ord)
|
| 348 |
|
| 349 |
|
| 350 |
-
return
|
|
|
|
| 55 |
# Load in multiple dataframes
|
| 56 |
df = pl.scan_parquet(f"az://{dataset}.parquet", storage_options=storage_options).collect()
|
| 57 |
|
| 58 |
+
# Create the second tab content with scatter-plot_db1-5 and scatter-plot_db1-6
|
| 59 |
tab2_content = html.Div([
|
| 60 |
html.Div([
|
| 61 |
html.Label("S-cycle genes"),
|
|
|
|
| 164 |
]),
|
| 165 |
]),
|
| 166 |
html.Div([
|
| 167 |
+
dcc.Graph(id='scatter-plot_db1-5', figure={}, className='three columns',config=config_fig)
|
| 168 |
]),
|
| 169 |
html.Div([
|
| 170 |
+
dcc.Graph(id='scatter-plot_db1-6', figure={}, className='three columns',config=config_fig)
|
| 171 |
]),
|
| 172 |
html.Div([
|
| 173 |
+
dcc.Graph(id='scatter-plot_db1-7', figure={}, className='three columns',config=config_fig)
|
| 174 |
]),
|
| 175 |
html.Div([
|
| 176 |
+
dcc.Graph(id='scatter-plot_db1-8', figure={}, className='three columns',config=config_fig)
|
| 177 |
]),
|
| 178 |
])
|
| 179 |
|
| 180 |
+
# Create the second tab content with scatter-plot_db1-5 and scatter-plot_db1-6
|
| 181 |
tab3_content = html.Div([
|
| 182 |
html.Div([
|
| 183 |
html.Label("UMAP condition 1"),
|
|
|
|
| 187 |
dcc.Dropdown(id='dpdn6', value="Pax6", multi=False,
|
| 188 |
options=df.columns),
|
| 189 |
html.Div([
|
| 190 |
+
dcc.Graph(id='scatter-plot_db1-9', figure={}, className='four columns', hoverData=None ,config=config_fig)
|
| 191 |
]),
|
| 192 |
html.Div([
|
| 193 |
+
dcc.Graph(id='scatter-plot_db1-10', figure={}, className='four columns', hoverData=None, config=config_fig)
|
| 194 |
]),
|
| 195 |
html.Div([
|
| 196 |
+
dcc.Graph(id='scatter-plot_db1-11', figure={}, className='four columns',config=config_fig)
|
| 197 |
]),
|
| 198 |
html.Div([
|
| 199 |
+
dcc.Graph(id='my-graph_db12', figure={}, clickData=None, hoverData=None,
|
| 200 |
className='four columns',config=config_fig
|
| 201 |
)
|
| 202 |
]),
|
|
|
|
| 217 |
options=df.columns),
|
| 218 |
]),
|
| 219 |
html.Div([
|
| 220 |
+
dcc.Graph(id='scatter-plot_db1-12', figure={}, className='row',style={'width': '100vh', 'height': '90vh'})
|
| 221 |
]),
|
| 222 |
])
|
| 223 |
|
|
|
|
| 236 |
])
|
| 237 |
|
| 238 |
@callback(
|
| 239 |
+
Output(component_id='scatter-plot_db1-5', component_property='figure'),
|
| 240 |
+
Output(component_id='scatter-plot_db1-6', component_property='figure'),
|
| 241 |
+
Output(component_id='scatter-plot_db1-7', component_property='figure'),
|
| 242 |
+
Output(component_id='scatter-plot_db1-8', component_property='figure'),
|
| 243 |
+
Output(component_id='scatter-plot_db1-9', component_property='figure'),
|
| 244 |
+
Output(component_id='scatter-plot_db1-10', component_property='figure'),
|
| 245 |
+
Output(component_id='scatter-plot_db1-11', component_property='figure'),
|
| 246 |
+
Output(component_id='scatter-plot_db1-12', component_property='figure'),
|
| 247 |
+
Output(component_id='my-graph_db12', component_property='figure'),
|
| 248 |
Input(component_id='dpdn2', component_property='value'),
|
| 249 |
Input(component_id='dpdn3', component_property='value'),
|
| 250 |
Input(component_id='dpdn4', component_property='value'),
|
|
|
|
| 298 |
# Final part to join the percentage expressed and mean expression levels
|
| 299 |
expression_means = expression_means.join(dff_5, on=[col_chosen,"Gene"], how="inner")
|
| 300 |
|
| 301 |
+
fig_scatter_db1_5 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=s_chosen,
|
| 302 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 303 |
hover_name=None, title="S-cycle gene:",template="seaborn")
|
| 304 |
|
| 305 |
+
fig_scatter_db1_6 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=g2m_chosen,
|
| 306 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 307 |
hover_name='condition', title="G2M-cycle gene:",template="seaborn")
|
| 308 |
|
| 309 |
+
fig_scatter_db1_7 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="S_score",
|
| 310 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 311 |
hover_name='condition', title="S score:",template="seaborn")
|
| 312 |
|
| 313 |
+
fig_scatter_db1_8 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="G2M_score",
|
| 314 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 315 |
hover_name='condition', title="G2M score:",template="seaborn")
|
| 316 |
|
| 317 |
# Sort values of custom in-between
|
| 318 |
dff = dff.sort(condition1_chosen)
|
| 319 |
|
| 320 |
+
fig_scatter_db1_9 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition1_chosen,
|
| 321 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 322 |
hover_name=None,hover_data = None, template="seaborn",category_orders=cat_ord)
|
| 323 |
+
fig_scatter_db1_9.update_traces(hoverinfo='none', hovertemplate=None)
|
| 324 |
+
fig_scatter_db1_9.update_layout(hovermode=False)
|
| 325 |
|
| 326 |
+
fig_scatter_db1_10 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition2_chosen,
|
| 327 |
labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 328 |
hover_name='condition',template="seaborn")
|
| 329 |
|
| 330 |
+
fig_scatter_db1_11 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, color=condition1_chosen,
|
| 331 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 332 |
hover_name='condition',template="seaborn",category_orders=cat_ord)
|
| 333 |
|
| 334 |
# Reorder categories on natural sorting or on the integrated cell state order of the paper
|
| 335 |
if col_chosen == "integrated_cell_states":
|
| 336 |
+
fig_scatter_db1_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
|
| 337 |
size="percentage", size_max = 20,
|
| 338 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 339 |
hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique())})
|
| 340 |
else:
|
| 341 |
+
fig_scatter_db1_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
|
| 342 |
size="percentage", size_max = 20,
|
| 343 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 344 |
hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
|
| 345 |
|
| 346 |
+
fig_violin_db12 = px.violin(data_frame=dff, x=condition1_chosen, y=condition2_chosen, box=True, points="all",
|
| 347 |
color=condition1_chosen, hover_name=condition1_chosen,template="seaborn",category_orders=cat_ord)
|
| 348 |
|
| 349 |
|
| 350 |
+
return fig_scatter_db1_5, fig_scatter_db1_6, fig_scatter_db1_7, fig_scatter_db1_8, fig_scatter_db1_9, fig_scatter_db1_10, fig_scatter_db1_11, fig_scatter_db1_12, fig_violin_db12
|