Arts-of-coding commited on
Commit
c8c4718
1 Parent(s): 2f6a2ac

Update dash_plotly_QC_scRNA.py

Browse files
Files changed (1) hide show
  1. dash_plotly_QC_scRNA.py +9 -8
dash_plotly_QC_scRNA.py CHANGED
@@ -374,19 +374,20 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
374
  total_count = len(dff)
375
  category_counts = category_counts.with_columns((pl.col("count") / total_count * 100).alias("normalized_count"))
376
 
 
 
 
 
 
 
 
377
  # Calculate the mean expression
378
  round_precision = 2
379
  category_counts = dff.group_by(condition1_chosen).agg(pl.col(condition1_chosen).count().alias("count"))
380
  category_sums = dff.group_by(condition1_chosen).agg(pl.col(condition1_chosen).sum().alias("sum"))
381
  total_count = len(dff)
382
  category_means = category_sums.select((pl.col("sum") / total_count).round(round_precision).alias("mean"))
383
-
384
- # Display the result
385
- labels = category_counts["batch"].to_list()
386
- values = category_counts["normalized_count"].to_list()
387
-
388
- total_cells = total_count # Calculate total number of cells
389
- pie_title = f'Percentage of Total Cells: {total_cells}' # Include total cells in the title
390
 
391
  fig_pie = px.pie(names=labels, values=values, title=pie_title,template="seaborn")
392
 
@@ -436,7 +437,7 @@ def update_graph_and_pie_chart(batch_chosen, s_chosen, g2m_chosen, condition1_ch
436
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
437
  hover_name='batch',template="seaborn")
438
 
439
- fig_scatter_12 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, size=category_means, color='batch',
440
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
441
  hover_name='batch',template="seaborn")
442
 
 
374
  total_count = len(dff)
375
  category_counts = category_counts.with_columns((pl.col("count") / total_count * 100).alias("normalized_count"))
376
 
377
+ # Display the result
378
+ labels = category_counts["batch"].to_list()
379
+ values = category_counts["normalized_count"].to_list()
380
+
381
+ total_cells = total_count # Calculate total number of cells
382
+ pie_title = f'Percentage of Total Cells: {total_cells}' # Include total cells in the title
383
+
384
  # Calculate the mean expression
385
  round_precision = 2
386
  category_counts = dff.group_by(condition1_chosen).agg(pl.col(condition1_chosen).count().alias("count"))
387
  category_sums = dff.group_by(condition1_chosen).agg(pl.col(condition1_chosen).sum().alias("sum"))
388
  total_count = len(dff)
389
  category_means = category_sums.select((pl.col("sum") / total_count).round(round_precision).alias("mean"))
390
+ values_mean = category_counts["mean"].to_list()
 
 
 
 
 
 
391
 
392
  fig_pie = px.pie(names=labels, values=values, title=pie_title,template="seaborn")
393
 
 
437
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
438
  hover_name='batch',template="seaborn")
439
 
440
+ fig_scatter_12 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, size=values_mean,
441
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
442
  hover_name='batch',template="seaborn")
443