Spaces:
Sleeping
Sleeping
Update dash_plotly_QC_scRNA.py
Browse files- dash_plotly_QC_scRNA.py +26 -17
dash_plotly_QC_scRNA.py
CHANGED
|
@@ -36,18 +36,16 @@ def read_config(filename):
|
|
| 36 |
return config
|
| 37 |
|
| 38 |
config = read_config(config_path)
|
| 39 |
-
path_parquet = config.get("path_parquet")
|
| 40 |
col_batch = config.get("col_batch")
|
| 41 |
col_features = config.get("col_features")
|
| 42 |
col_counts = config.get("col_counts")
|
| 43 |
col_mt = config.get("col_mt")
|
| 44 |
|
| 45 |
-
filepath = f"az://{path_parquet}"
|
| 46 |
-
|
| 47 |
storage_options={'account_name': AZURE_STORAGE_ACCOUNT, 'account_key': AZURE_STORAGE_ACCESS_KEY,'anon': False}
|
| 48 |
#azfs = AzureBlobFileSystem(**storage_options )
|
| 49 |
|
| 50 |
-
|
| 51 |
#abfs = AzureBlobFileSystem(account_name=accountname,account_key=accountkey)
|
| 52 |
#df = df.rename({"__index_level_0__": "Unnamed: 0"})
|
| 53 |
|
|
@@ -55,18 +53,11 @@ df = pl.read_parquet(filepath,storage_options=storage_options)
|
|
| 55 |
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
|
| 56 |
app = dash.Dash(__name__, external_stylesheets=external_stylesheets) #, requests_pathname_prefix='/dashboard1/'
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
max_value_2 = df[col_counts].max()
|
| 64 |
-
max_value_2 = round(max_value_2)
|
| 65 |
-
|
| 66 |
-
min_value_3 = df[col_mt].min()
|
| 67 |
-
min_value_3 = round(min_value_3, 1)
|
| 68 |
-
max_value_3 = df[col_mt].max()
|
| 69 |
-
max_value_3 = round(max_value_3, 1)
|
| 70 |
|
| 71 |
# Loads in the conditions specified in the yaml file
|
| 72 |
|
|
@@ -243,6 +234,7 @@ app.layout = html.Div([
|
|
| 243 |
dcc.Tabs(id='tabs', style= {'width': 600,
|
| 244 |
'font-size': '100%',
|
| 245 |
'height': 50}, value='tab1',children=[
|
|
|
|
| 246 |
dcc.Tab(label='QC', value='tab1', children=tab1_content),
|
| 247 |
dcc.Tab(label='Cell cycle', value='tab2', children=tab2_content),
|
| 248 |
dcc.Tab(label='Custom', value='tab3', children=tab3_content),
|
|
@@ -298,6 +290,7 @@ def update_slider_values(min_1, max_1, min_2, max_2, min_3, max_3):
|
|
| 298 |
Output(component_id='scatter-plot-11', component_property='figure'),
|
| 299 |
Output(component_id='scatter-plot-12', component_property='figure'),
|
| 300 |
Output(component_id='my-graph2', component_property='figure'),
|
|
|
|
| 301 |
Input(component_id='dpdn2', component_property='value'),
|
| 302 |
Input(component_id='dpdn3', component_property='value'),
|
| 303 |
Input(component_id='dpdn4', component_property='value'),
|
|
@@ -309,7 +302,23 @@ def update_slider_values(min_1, max_1, min_2, max_2, min_3, max_3):
|
|
| 309 |
Input(component_id='range-slider-3', component_property='value')
|
| 310 |
)
|
| 311 |
|
| 312 |
-
def update_graph_and_pie_chart(col_chosen, s_chosen, g2m_chosen, condition1_chosen, condition2_chosen, condition3_chosen, range_value_1, range_value_2, range_value_3): #batch_chosen,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
batch_chosen = df[col_chosen].unique().to_list()
|
| 314 |
dff = df.filter(
|
| 315 |
(pl.col(col_chosen).cast(str).is_in(batch_chosen)) &
|
|
|
|
| 36 |
return config
|
| 37 |
|
| 38 |
config = read_config(config_path)
|
| 39 |
+
#path_parquet = config.get("path_parquet")
|
| 40 |
col_batch = config.get("col_batch")
|
| 41 |
col_features = config.get("col_features")
|
| 42 |
col_counts = config.get("col_counts")
|
| 43 |
col_mt = config.get("col_mt")
|
| 44 |
|
|
|
|
|
|
|
| 45 |
storage_options={'account_name': AZURE_STORAGE_ACCOUNT, 'account_key': AZURE_STORAGE_ACCESS_KEY,'anon': False}
|
| 46 |
#azfs = AzureBlobFileSystem(**storage_options )
|
| 47 |
|
| 48 |
+
|
| 49 |
#abfs = AzureBlobFileSystem(account_name=accountname,account_key=accountkey)
|
| 50 |
#df = df.rename({"__index_level_0__": "Unnamed: 0"})
|
| 51 |
|
|
|
|
| 53 |
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
|
| 54 |
app = dash.Dash(__name__, external_stylesheets=external_stylesheets) #, requests_pathname_prefix='/dashboard1/'
|
| 55 |
|
| 56 |
+
tab0_content = html.Div([
|
| 57 |
+
html.Label("Dataset chosen"),
|
| 58 |
+
dcc.Dropdown(id='dpdn1', value="d1011/10xflexd1011_umap_clusres", multi=False,
|
| 59 |
+
options=["corg/10xflexcorg_umap_clusres","d1011/10xflexd1011_umap_clusres"])
|
| 60 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# Loads in the conditions specified in the yaml file
|
| 63 |
|
|
|
|
| 234 |
dcc.Tabs(id='tabs', style= {'width': 600,
|
| 235 |
'font-size': '100%',
|
| 236 |
'height': 50}, value='tab1',children=[
|
| 237 |
+
dcc.Tab(label='Dataset', value='tab0', children=tab0_content),
|
| 238 |
dcc.Tab(label='QC', value='tab1', children=tab1_content),
|
| 239 |
dcc.Tab(label='Cell cycle', value='tab2', children=tab2_content),
|
| 240 |
dcc.Tab(label='Custom', value='tab3', children=tab3_content),
|
|
|
|
| 290 |
Output(component_id='scatter-plot-11', component_property='figure'),
|
| 291 |
Output(component_id='scatter-plot-12', component_property='figure'),
|
| 292 |
Output(component_id='my-graph2', component_property='figure'),
|
| 293 |
+
Input(component_id='dpdn1', component_property='value'),
|
| 294 |
Input(component_id='dpdn2', component_property='value'),
|
| 295 |
Input(component_id='dpdn3', component_property='value'),
|
| 296 |
Input(component_id='dpdn4', component_property='value'),
|
|
|
|
| 302 |
Input(component_id='range-slider-3', component_property='value')
|
| 303 |
)
|
| 304 |
|
| 305 |
+
def update_graph_and_pie_chart(dataset_chosen, col_chosen, s_chosen, g2m_chosen, condition1_chosen, condition2_chosen, condition3_chosen, range_value_1, range_value_2, range_value_3): #batch_chosen,
|
| 306 |
+
filepath = f"az://data10xflex/{dataset_chosen}"
|
| 307 |
+
df = pl.read_parquet(filepath,storage_options=storage_options)
|
| 308 |
+
|
| 309 |
+
min_value = df[col_features].min()
|
| 310 |
+
max_value = df[col_features].max()
|
| 311 |
+
|
| 312 |
+
min_value_2 = df[col_counts].min()
|
| 313 |
+
min_value_2 = round(min_value_2)
|
| 314 |
+
max_value_2 = df[col_counts].max()
|
| 315 |
+
max_value_2 = round(max_value_2)
|
| 316 |
+
|
| 317 |
+
min_value_3 = df[col_mt].min()
|
| 318 |
+
min_value_3 = round(min_value_3, 1)
|
| 319 |
+
max_value_3 = df[col_mt].max()
|
| 320 |
+
max_value_3 = round(max_value_3, 1)
|
| 321 |
+
|
| 322 |
batch_chosen = df[col_chosen].unique().to_list()
|
| 323 |
dff = df.filter(
|
| 324 |
(pl.col(col_chosen).cast(str).is_in(batch_chosen)) &
|