Spaces:
Sleeping
Sleeping
Update dash_plotly_QC_scRNA.py
Browse files- dash_plotly_QC_scRNA.py +6 -12
dash_plotly_QC_scRNA.py
CHANGED
|
@@ -392,17 +392,11 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
|
|
| 392 |
pie_title = f'Percentage of Total Cells: {total_cells}' # Include total cells in the title
|
| 393 |
|
| 394 |
# Calculate the mean expression
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
category_sums = dff.group_by(i).agg(pl.col(i).sum().alias("sum"))
|
| 401 |
-
total_count = len(dff)
|
| 402 |
-
category_means = category_sums.select((pl.col("sum") / total_count).round(round_precision).alias(i))
|
| 403 |
-
values_mean += category_means[i].to_list()
|
| 404 |
-
print(values_mean)
|
| 405 |
-
|
| 406 |
fig_pie = px.pie(names=labels, values=values, title=pie_title,template="seaborn")
|
| 407 |
|
| 408 |
# Create the scatter plots
|
|
@@ -451,7 +445,7 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
|
|
| 451 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 452 |
hover_name='batch',template="seaborn")
|
| 453 |
|
| 454 |
-
fig_scatter_12 = px.scatter(data_frame=
|
| 455 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 456 |
hover_name='batch',template="seaborn")
|
| 457 |
|
|
|
|
| 392 |
pie_title = f'Percentage of Total Cells: {total_cells}' # Include total cells in the title
|
| 393 |
|
| 394 |
# Calculate the mean expression
|
| 395 |
+
|
| 396 |
+
# Melt wide format DataFrame into long format
|
| 397 |
+
dff_pre = dff["batch","Cdc45","Uhrf1","Mcm2","Slbp"]
|
| 398 |
+
dff_long = dff_pre.melt(id_vars="batch", variable_name="Gene", value_name="Expression")
|
| 399 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
fig_pie = px.pie(names=labels, values=values, title=pie_title,template="seaborn")
|
| 401 |
|
| 402 |
# Create the scatter plots
|
|
|
|
| 445 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 446 |
hover_name='batch',template="seaborn")
|
| 447 |
|
| 448 |
+
fig_scatter_12 = px.scatter(data_frame=dff_long, x="batch", y=condition3_chosen, color=condition3_chosen,
|
| 449 |
#labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
|
| 450 |
hover_name='batch',template="seaborn")
|
| 451 |
|