Arts-of-coding commited on
Commit
52c927a
·
verified ·
1 Parent(s): badc6ed

Update pages/DLC_corg_week16.py

Browse files
Files changed (1) hide show
  1. pages/DLC_corg_week16.py +33 -33
pages/DLC_corg_week16.py CHANGED
@@ -56,7 +56,7 @@ storage_options={'account_name': AZURE_STORAGE_ACCOUNT, 'account_key': AZURE_STO
56
  # Load in multiple dataframes
57
  df = pl.scan_parquet(f"az://{dataset}.parquet", storage_options=storage_options).collect()
58
 
59
- # Create the second tab content with scatter-plot_dbw6-5 and scatter-plot_dbw6-6
60
  tab2_content = html.Div([
61
  html.Div([
62
  html.Label("S-cycle genes"),
@@ -74,20 +74,20 @@ tab2_content = html.Div([
74
  "GAS2L3","CBX5","CENPA"]),
75
  ]),
76
  html.Div([
77
- dcc.Graph(id='scatter-plot_dbw6-5', figure={}, className='three columns',config=config_fig)
78
  ]),
79
  html.Div([
80
- dcc.Graph(id='scatter-plot_dbw6-6', figure={}, className='three columns',config=config_fig)
81
  ]),
82
  html.Div([
83
- dcc.Graph(id='scatter-plot_dbw6-7', figure={}, className='three columns',config=config_fig)
84
  ]),
85
  html.Div([
86
- dcc.Graph(id='scatter-plot_dbw6-8', figure={}, className='three columns',config=config_fig)
87
  ]),
88
  ])
89
 
90
- # Create the second tab content with scatter-plot_dbw6-5 and scatter-plot_dbw6-6
91
  tab3_content = html.Div([
92
  html.Div([
93
  html.Label("UMAP condition 1"),
@@ -97,16 +97,16 @@ tab3_content = html.Div([
97
  dcc.Dropdown(id='dpdn6', value="PAX6", multi=False,
98
  options=df.columns),
99
  html.Div([
100
- dcc.Graph(id='scatter-plot_dbw6-9', figure={}, className='four columns', hoverData=None ,config=config_fig)
101
  ]),
102
  html.Div([
103
- dcc.Graph(id='scatter-plot_dbw6-10', figure={}, className='four columns', hoverData=None, config=config_fig)
104
  ]),
105
  html.Div([
106
- dcc.Graph(id='scatter-plot_dbw6-11', figure={}, className='four columns',config=config_fig)
107
  ]),
108
  html.Div([
109
- dcc.Graph(id='my-graph_dbw62', figure={}, clickData=None, hoverData=None,
110
  className='four columns',config=config_fig
111
  )
112
  ]),
@@ -123,7 +123,7 @@ tab4_content = html.Div([
123
  options=df.columns),
124
  ]),
125
  html.Div([
126
- dcc.Graph(id='scatter-plot_dbw6-12', figure={}, className='row',style={'width': '100vh', 'height': '90vh'})
127
  ]),
128
  ])
129
 
@@ -142,15 +142,15 @@ layout = html.Div([
142
  ])
143
 
144
  @callback(
145
- Output(component_id='scatter-plot_dbw6-5', component_property='figure'),
146
- Output(component_id='scatter-plot_dbw6-6', component_property='figure'),
147
- Output(component_id='scatter-plot_dbw6-7', component_property='figure'),
148
- Output(component_id='scatter-plot_dbw6-8', component_property='figure'),
149
- Output(component_id='scatter-plot_dbw6-9', component_property='figure'),
150
- Output(component_id='scatter-plot_dbw6-10', component_property='figure'),
151
- Output(component_id='scatter-plot_dbw6-11', component_property='figure'),
152
- Output(component_id='scatter-plot_dbw6-12', component_property='figure'),
153
- Output(component_id='my-graph_dbw62', component_property='figure'),
154
  Input(component_id='dpdn2', component_property='value'),
155
  Input(component_id='dpdn3', component_property='value'),
156
  Input(component_id='dpdn4', component_property='value'),
@@ -204,53 +204,53 @@ def update_graph_and_pie_chart(col_chosen, s_chosen, g2m_chosen, condition1_chos
204
  # Final part to join the percentage expressed and mean expression levels
205
  expression_means = expression_means.join(dff_5, on=[col_chosen,"Gene"], how="inner")
206
 
207
- fig_scatter_dbw6_5 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=s_chosen,
208
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
209
  hover_name=None, title="S-cycle gene:",template="seaborn")
210
 
211
- fig_scatter_dbw6_6 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=g2m_chosen,
212
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
213
  hover_name='sample', title="G2M-cycle gene:",template="seaborn")
214
 
215
- fig_scatter_dbw6_7 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="S_score",
216
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
217
  hover_name='sample', title="S score:",template="seaborn")
218
 
219
- fig_scatter_dbw6_8 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="G2M_score",
220
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
221
  hover_name='sample', title="G2M score:",template="seaborn")
222
 
223
  # Sort values of custom in-between
224
  dff = dff.sort(condition1_chosen)
225
 
226
- fig_scatter_dbw6_9 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition1_chosen,
227
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
228
  hover_name=None,hover_data = None, template="seaborn",category_orders=cat_ord)
229
- fig_scatter_dbw6_9.update_traces(hoverinfo='none', hovertemplate=None)
230
- fig_scatter_dbw6_9.update_layout(hovermode=False)
231
 
232
- fig_scatter_dbw6_10 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition2_chosen,
233
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
234
  hover_name='sample',template="seaborn")
235
 
236
- fig_scatter_dbw6_11 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, color=condition1_chosen,
237
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
238
  hover_name='sample',template="seaborn",category_orders=cat_ord)
239
 
240
  # Reorder categories on natural sorting or on the integrated cell state order of the paper
241
  if col_chosen == "integrated_cell_states":
242
- fig_scatter_dbw6_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
243
  size="percentage", size_max = 20,
244
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
245
  hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
246
  else:
247
- fig_scatter_dbw6_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
248
  size="percentage", size_max = 20,
249
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
250
  hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
251
 
252
- fig_violin_dbw62 = px.violin(data_frame=dff, x=condition1_chosen, y=condition2_chosen, box=True, points="all",
253
  color=condition1_chosen, hover_name=condition1_chosen,template="seaborn",category_orders=cat_ord)
254
 
255
 
256
- return fig_scatter_dbw6_5, fig_scatter_dbw6_6, fig_scatter_dbw6_7, fig_scatter_dbw6_8, fig_scatter_dbw6_9, fig_scatter_dbw6_10, fig_scatter_dbw6_11, fig_scatter_dbw6_12, fig_violin_dbw62 #fig_violin_dbw6, fig_pie_dbw6, fig_scatter_dbw6, fig_scatter_dbw6_2, fig_scatter_dbw6_3, fig_scatter_dbw6_4,
 
56
  # Load in multiple dataframes
57
  df = pl.scan_parquet(f"az://{dataset}.parquet", storage_options=storage_options).collect()
58
 
59
+ # Create the second tab content with scatter-plot_dbw16-5 and scatter-plot_dbw16-6
60
  tab2_content = html.Div([
61
  html.Div([
62
  html.Label("S-cycle genes"),
 
74
  "GAS2L3","CBX5","CENPA"]),
75
  ]),
76
  html.Div([
77
+ dcc.Graph(id='scatter-plot_dbw16-5', figure={}, className='three columns',config=config_fig)
78
  ]),
79
  html.Div([
80
+ dcc.Graph(id='scatter-plot_dbw16-6', figure={}, className='three columns',config=config_fig)
81
  ]),
82
  html.Div([
83
+ dcc.Graph(id='scatter-plot_dbw16-7', figure={}, className='three columns',config=config_fig)
84
  ]),
85
  html.Div([
86
+ dcc.Graph(id='scatter-plot_dbw16-8', figure={}, className='three columns',config=config_fig)
87
  ]),
88
  ])
89
 
90
+ # Create the second tab content with scatter-plot_dbw16-5 and scatter-plot_dbw16-6
91
  tab3_content = html.Div([
92
  html.Div([
93
  html.Label("UMAP condition 1"),
 
97
  dcc.Dropdown(id='dpdn6', value="PAX6", multi=False,
98
  options=df.columns),
99
  html.Div([
100
+ dcc.Graph(id='scatter-plot_dbw16-9', figure={}, className='four columns', hoverData=None ,config=config_fig)
101
  ]),
102
  html.Div([
103
+ dcc.Graph(id='scatter-plot_dbw16-10', figure={}, className='four columns', hoverData=None, config=config_fig)
104
  ]),
105
  html.Div([
106
+ dcc.Graph(id='scatter-plot_dbw16-11', figure={}, className='four columns',config=config_fig)
107
  ]),
108
  html.Div([
109
+ dcc.Graph(id='my-graph_dbw162', figure={}, clickData=None, hoverData=None,
110
  className='four columns',config=config_fig
111
  )
112
  ]),
 
123
  options=df.columns),
124
  ]),
125
  html.Div([
126
+ dcc.Graph(id='scatter-plot_dbw16-12', figure={}, className='row',style={'width': '100vh', 'height': '90vh'})
127
  ]),
128
  ])
129
 
 
142
  ])
143
 
144
  @callback(
145
+ Output(component_id='scatter-plot_dbw16-5', component_property='figure'),
146
+ Output(component_id='scatter-plot_dbw16-6', component_property='figure'),
147
+ Output(component_id='scatter-plot_dbw16-7', component_property='figure'),
148
+ Output(component_id='scatter-plot_dbw16-8', component_property='figure'),
149
+ Output(component_id='scatter-plot_dbw16-9', component_property='figure'),
150
+ Output(component_id='scatter-plot_dbw16-10', component_property='figure'),
151
+ Output(component_id='scatter-plot_dbw16-11', component_property='figure'),
152
+ Output(component_id='scatter-plot_dbw16-12', component_property='figure'),
153
+ Output(component_id='my-graph_dbw162', component_property='figure'),
154
  Input(component_id='dpdn2', component_property='value'),
155
  Input(component_id='dpdn3', component_property='value'),
156
  Input(component_id='dpdn4', component_property='value'),
 
204
  # Final part to join the percentage expressed and mean expression levels
205
  expression_means = expression_means.join(dff_5, on=[col_chosen,"Gene"], how="inner")
206
 
207
+ fig_scatter_dbw16_5 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=s_chosen,
208
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
209
  hover_name=None, title="S-cycle gene:",template="seaborn")
210
 
211
+ fig_scatter_dbw16_6 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=g2m_chosen,
212
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
213
  hover_name='sample', title="G2M-cycle gene:",template="seaborn")
214
 
215
+ fig_scatter_dbw16_7 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="S_score",
216
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
217
  hover_name='sample', title="S score:",template="seaborn")
218
 
219
+ fig_scatter_dbw16_8 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color="G2M_score",
220
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
221
  hover_name='sample', title="G2M score:",template="seaborn")
222
 
223
  # Sort values of custom in-between
224
  dff = dff.sort(condition1_chosen)
225
 
226
+ fig_scatter_dbw16_9 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition1_chosen,
227
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
228
  hover_name=None,hover_data = None, template="seaborn",category_orders=cat_ord)
229
+ fig_scatter_dbw16_9.update_traces(hoverinfo='none', hovertemplate=None)
230
+ fig_scatter_dbw16_9.update_layout(hovermode=False)
231
 
232
+ fig_scatter_dbw16_10 = px.scatter(data_frame=dff, x='X_umap-0', y='X_umap-1', color=condition2_chosen,
233
  labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
234
  hover_name='sample',template="seaborn")
235
 
236
+ fig_scatter_dbw16_11 = px.scatter(data_frame=dff, x=condition1_chosen, y=condition2_chosen, color=condition1_chosen,
237
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
238
  hover_name='sample',template="seaborn",category_orders=cat_ord)
239
 
240
  # Reorder categories on natural sorting or on the integrated cell state order of the paper
241
  if col_chosen == "integrated_cell_states":
242
+ fig_scatter_dbw16_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
243
  size="percentage", size_max = 20,
244
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
245
  hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
246
  else:
247
+ fig_scatter_dbw16_12 = px.scatter(data_frame=expression_means, x="Gene", y=col_chosen, color="Mean expression",
248
  size="percentage", size_max = 20,
249
  #labels={'X_umap-0': 'umap1' , 'X_umap-1': 'umap2'},
250
  hover_name=col_chosen,template="seaborn",category_orders={col_chosen: natsorted(expression_means[col_chosen].unique()),"Gene": condition3_chosen})
251
 
252
+ fig_violin_dbw162 = px.violin(data_frame=dff, x=condition1_chosen, y=condition2_chosen, box=True, points="all",
253
  color=condition1_chosen, hover_name=condition1_chosen,template="seaborn",category_orders=cat_ord)
254
 
255
 
256
+ return fig_scatter_dbw16_5, fig_scatter_dbw16_6, fig_scatter_dbw16_7, fig_scatter_dbw16_8, fig_scatter_dbw16_9, fig_scatter_dbw16_10, fig_scatter_dbw16_11, fig_scatter_dbw16_12, fig_violin_dbw162 #fig_violin_dbw16, fig_pie_dbw16, fig_scatter_dbw16, fig_scatter_dbw16_2, fig_scatter_dbw16_3, fig_scatter_dbw16_4,