Arts-of-coding commited on
Commit
5af716e
·
verified ·
1 Parent(s): cd21e59

Update dash_plotly_QC_scRNA.py

Browse files
Files changed (1) hide show
  1. dash_plotly_QC_scRNA.py +14 -34
dash_plotly_QC_scRNA.py CHANGED
@@ -36,16 +36,18 @@ 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
  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,39 +55,18 @@ storage_options={'account_name': AZURE_STORAGE_ACCOUNT, 'account_key': AZURE_STO
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
- @app.callback(
63
- Output('dynamic-table', 'children'),
64
- Input(component_id='dpdn1', component_property='value')
65
- )
66
- def update_table(dataset_chosen):
67
- filepath = f"az://data10xflex/{dataset_chosen}"
68
- df = pl.read_parquet(filepath, storage_options=storage_options)
69
-
70
- min_value = df[col_features].min().item()
71
- max_value = df[col_features].max().item()
72
-
73
- min_value_2 = round(df[col_counts].min())
74
- max_value_2 = round(df[col_counts].max())
75
-
76
- min_value_3 = round(df[col_mt].min(), 1)
77
- max_value_3 = round(df[col_mt].max(), 1)
78
 
79
- # Create other visualizations or perform calculations below using the updated df variable
 
 
 
80
 
81
- return [
82
- html.H5(f'Minimum Value - {col_features}: {min_value}'),
83
- html.H5(f'Maximum Value - {col_features}: {max_value}'),
84
- html.H5(f'Minimum Value - {col_counts}: {min_value_2}'),
85
- html.H5(f'Maximum Value - {col_counts}: {max_value_2}'),
86
- html.H5(f'Minimum Value - {col_mt}: {min_value_3}'),
87
- html.H5(f'Maximum Value - {col_mt}: {max_value_3}'),
88
- ]
89
 
90
  # Loads in the conditions specified in the yaml file
91
 
@@ -262,7 +243,6 @@ app.layout = html.Div([
262
  dcc.Tabs(id='tabs', style= {'width': 600,
263
  'font-size': '100%',
264
  'height': 50}, value='tab1',children=[
265
- dcc.Tab(label='Dataset', value='tab0', children=tab0_content),
266
  dcc.Tab(label='QC', value='tab1', children=tab1_content),
267
  dcc.Tab(label='Cell cycle', value='tab2', children=tab2_content),
268
  dcc.Tab(label='Custom', value='tab3', children=tab3_content),
 
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
+ df = pl.read_parquet(filepath,storage_options=storage_options)
51
  #abfs = AzureBlobFileSystem(account_name=accountname,account_key=accountkey)
52
  #df = df.rename({"__index_level_0__": "Unnamed: 0"})
53
 
 
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
+ min_value = df[col_features].min()
59
+ max_value = df[col_features].max()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
+ min_value_2 = df[col_counts].min()
62
+ min_value_2 = round(min_value_2)
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
  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),