Update dash_plotly_QC_scRNA.py
Browse files- dash_plotly_QC_scRNA.py +11 -15
dash_plotly_QC_scRNA.py
CHANGED
|
@@ -361,22 +361,18 @@ def update_slider_values(min_1, max_1, min_2, max_2, min_3, max_3):
|
|
| 361 |
)
|
| 362 |
|
| 363 |
def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_chosen, condition2_chosen, condition3_chosen, range_value_1, range_value_2, range_value_3):
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
(feature_cols <= range_value_1[1]) & \
|
| 374 |
-
(count_cols >= range_value_2[0]) & \
|
| 375 |
-
(count_cols <= range_value_2[1]) & \
|
| 376 |
-
(mt_cols >= range_value_3[0]) & \
|
| 377 |
-
(mt_cols <= range_value_3[1])
|
| 378 |
|
| 379 |
-
|
|
|
|
| 380 |
|
| 381 |
# Plot figures
|
| 382 |
fig_violin = px.violin(data_frame=dff, x='batch', y=col_features, box=True, points="all",
|
|
|
|
| 361 |
)
|
| 362 |
|
| 363 |
def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_chosen, condition2_chosen, condition3_chosen, range_value_1, range_value_2, range_value_3):
|
| 364 |
+
dff = df.filter(
|
| 365 |
+
(pl.col('batch').cast(str).is_in(batch_chosen)) &
|
| 366 |
+
(pl.col(col_features) >= range_value_1[0]) &
|
| 367 |
+
(pl.col(col_features) <= range_value_1[1]) &
|
| 368 |
+
(pl.col(col_counts) >= range_value_2[0]) &
|
| 369 |
+
(pl.col(col_counts) <= range_value_2[1]) &
|
| 370 |
+
(pl.col(col_mt) >= range_value_3[0]) &
|
| 371 |
+
(pl.col(col_mt) <= range_value_3[1])
|
| 372 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
|
| 374 |
+
#Drop categories that are not in the filtered data
|
| 375 |
+
dff = dff.with_columns(dff['batch'].cast(pl.Categorical))
|
| 376 |
|
| 377 |
# Plot figures
|
| 378 |
fig_violin = px.violin(data_frame=dff, x='batch', y=col_features, box=True, points="all",
|