Spaces:
Running
Running
Update dash_plotly_QC_scRNA.py
Browse files- dash_plotly_QC_scRNA.py +14 -1
dash_plotly_QC_scRNA.py
CHANGED
@@ -272,6 +272,9 @@ tab3_content = html.Div([
|
|
272 |
className='four columns',config=config_fig
|
273 |
)
|
274 |
]),
|
|
|
|
|
|
|
275 |
])
|
276 |
|
277 |
# Define the tabs layout
|
@@ -331,6 +334,7 @@ def update_slider_values(min_1, max_1, min_2, max_2, min_3, max_3):
|
|
331 |
Output(component_id='scatter-plot-9', component_property='figure'),
|
332 |
Output(component_id='scatter-plot-10', component_property='figure'),
|
333 |
Output(component_id='scatter-plot-11', component_property='figure'),
|
|
|
334 |
Output(component_id='my-graph2', component_property='figure'),
|
335 |
Input(component_id='dpdn2', component_property='value'),
|
336 |
Input(component_id='dpdn3', component_property='value'),
|
@@ -366,6 +370,11 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
|
|
366 |
total_count = len(dff)
|
367 |
category_counts = category_counts.with_columns((pl.col("count") / total_count * 100).alias("normalized_count"))
|
368 |
|
|
|
|
|
|
|
|
|
|
|
369 |
# Display the result
|
370 |
labels = category_counts["batch"].to_list()
|
371 |
values = category_counts["normalized_count"].to_list()
|
@@ -421,11 +430,15 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
|
|
421 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
422 |
hover_name='batch',template="seaborn")
|
423 |
|
|
|
|
|
|
|
|
|
424 |
fig_violin2 = px.violin(data_frame=dff, x=condition1_chosen, y=condition2_chosen, box=True, points="all",
|
425 |
color=condition1_chosen, hover_name=condition1_chosen,template="seaborn")
|
426 |
|
427 |
|
428 |
-
return fig_violin, fig_pie, fig_scatter, fig_scatter_2, fig_scatter_3, fig_scatter_4, fig_scatter_5, fig_scatter_6, fig_scatter_7, fig_scatter_8, fig_scatter_9, fig_scatter_10, fig_scatter_11, fig_violin2
|
429 |
|
430 |
# Set http://localhost:5000/ in web browser
|
431 |
# Now create your regular FASTAPI application
|
|
|
272 |
className='four columns',config=config_fig
|
273 |
)
|
274 |
]),
|
275 |
+
html.Div([
|
276 |
+
dcc.Graph(id='scatter-plot-12', figure={}, className='four columns',config=config_fig)
|
277 |
+
]),
|
278 |
])
|
279 |
|
280 |
# Define the tabs layout
|
|
|
334 |
Output(component_id='scatter-plot-9', component_property='figure'),
|
335 |
Output(component_id='scatter-plot-10', component_property='figure'),
|
336 |
Output(component_id='scatter-plot-11', component_property='figure'),
|
337 |
+
Output(component_id='scatter-plot-12', component_property='figure'),
|
338 |
Output(component_id='my-graph2', component_property='figure'),
|
339 |
Input(component_id='dpdn2', component_property='value'),
|
340 |
Input(component_id='dpdn3', component_property='value'),
|
|
|
370 |
total_count = len(dff)
|
371 |
category_counts = category_counts.with_columns((pl.col("count") / total_count * 100).alias("normalized_count"))
|
372 |
|
373 |
+
# Calculate the mean expression
|
374 |
+
round_precision = 2
|
375 |
+
category_sums = dff.group_by(condition1_chosen).agg(pl.col(condition1_chosen).sum().alias("sum"))
|
376 |
+
category_means = category_sums.select((pl.col("sum") / total_count).round(round_precision).alias("mean"))
|
377 |
+
|
378 |
# Display the result
|
379 |
labels = category_counts["batch"].to_list()
|
380 |
values = category_counts["normalized_count"].to_list()
|
|
|
430 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
431 |
hover_name='batch',template="seaborn")
|
432 |
|
433 |
+
fig_scatter_12 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, size=category_means, color='batch',
|
434 |
+
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
435 |
+
hover_name='batch',template="seaborn")
|
436 |
+
|
437 |
fig_violin2 = px.violin(data_frame=dff, x=condition1_chosen, y=condition2_chosen, box=True, points="all",
|
438 |
color=condition1_chosen, hover_name=condition1_chosen,template="seaborn")
|
439 |
|
440 |
|
441 |
+
return fig_violin, fig_pie, fig_scatter, fig_scatter_2, fig_scatter_3, fig_scatter_4, fig_scatter_5, fig_scatter_6, fig_scatter_7, fig_scatter_8, fig_scatter_9, fig_scatter_10, fig_scatter_11, fig_scatter_12, fig_violin2
|
442 |
|
443 |
# Set http://localhost:5000/ in web browser
|
444 |
# Now create your regular FASTAPI application
|