libokj commited on
Commit
ba86ddf
·
1 Parent(s): 891f1d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1121,10 +1121,9 @@ def update_df(file, progress=gr.Progress(track_tqdm=True)):
1121
 
1122
  def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(track_tqdm=True)):
1123
  df_html = df.copy(deep=True)
1124
- df_html.dropna(how='all', axis=1, inplace=True)
1125
  column_aliases = COLUMN_ALIASES.copy()
1126
  cols_left = list(pd.Index([
1127
- 'ID1', 'ID2', 'Compound', 'Scaffold', 'Pharmacophore', 'X1', 'Scaffold SMILES', 'X2', 'Y^'
1128
  ]).intersection(df_html.columns))
1129
  # cols_right = list(pd.Index(['X1', 'X2']).intersection(df_html.columns))
1130
  # df_html = df_html[cols_left + (df_html.columns.drop(cols_left + cols_right).tolist()) + cols_right]
@@ -1208,6 +1207,8 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1208
  if columns_unique is not None:
1209
  unique_df = df_html.loc[:, columns_unique].iloc[[0]].copy()
1210
  df_html = df_html.loc[:, ~columns_unique]
 
 
1211
 
1212
  if not file:
1213
  if 'Compound ID' in df_html.columns:
@@ -1299,9 +1300,10 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1299
  report_table = pn.widgets.Tabulator(
1300
  df_html, formatters=formatters,
1301
  frozen_columns=[
1302
- 'Index', 'Target ID', 'Compound ID', 'Compound'
1303
  ],
1304
- disabled=True, sizing_mode='stretch_both', pagination='local', page_size=30)
 
1305
 
1306
  for i, col in enumerate(num_cols):
1307
  cmap = sns.light_palette(num_col_colors[i], as_cmap=True)
@@ -1338,6 +1340,7 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1338
 
1339
  .tabulator-cell {
1340
  overflow: visible !important;
 
1341
  }
1342
 
1343
  .tabulator-cell:hover {
@@ -1381,7 +1384,7 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1381
  raw_css=[panel_css],
1382
  js_files={'panel_custom': 'static/panel.js', '3Dmol': 'static/3Dmol-min.js'},
1383
  # js_modules={'3Dmol': 'static/3Dmol-min.js'},
1384
- inline=True
1385
  )
1386
 
1387
  template = pn.template.VanillaTemplate(
 
1121
 
1122
  def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(track_tqdm=True)):
1123
  df_html = df.copy(deep=True)
 
1124
  column_aliases = COLUMN_ALIASES.copy()
1125
  cols_left = list(pd.Index([
1126
+ 'ID1', 'ID2', 'Compound', 'Scaffold', 'Pharmacophore', 'X1', 'Scaffold SMILES', 'X2', 'Y^'
1127
  ]).intersection(df_html.columns))
1128
  # cols_right = list(pd.Index(['X1', 'X2']).intersection(df_html.columns))
1129
  # df_html = df_html[cols_left + (df_html.columns.drop(cols_left + cols_right).tolist()) + cols_right]
 
1207
  if columns_unique is not None:
1208
  unique_df = df_html.loc[:, columns_unique].iloc[[0]].copy()
1209
  df_html = df_html.loc[:, ~columns_unique]
1210
+ df_html.dropna(how='all', axis=1, inplace=True)
1211
+ unique_df.dropna(how='all', axis=1, inplace=True)
1212
 
1213
  if not file:
1214
  if 'Compound ID' in df_html.columns:
 
1300
  report_table = pn.widgets.Tabulator(
1301
  df_html, formatters=formatters,
1302
  frozen_columns=[
1303
+ 'Index', 'Target ID', 'Compound ID', 'Compound Name', 'Compound'
1304
  ],
1305
+ disabled=True, sizing_mode='stretch_both', pagination='local', page_size=30
1306
+ )
1307
 
1308
  for i, col in enumerate(num_cols):
1309
  cmap = sns.light_palette(num_col_colors[i], as_cmap=True)
 
1340
 
1341
  .tabulator-cell {
1342
  overflow: visible !important;
1343
+ align-content: center !important;
1344
  }
1345
 
1346
  .tabulator-cell:hover {
 
1384
  raw_css=[panel_css],
1385
  js_files={'panel_custom': 'static/panel.js', '3Dmol': 'static/3Dmol-min.js'},
1386
  # js_modules={'3Dmol': 'static/3Dmol-min.js'},
1387
+ inline=True,
1388
  )
1389
 
1390
  template = pn.template.VanillaTemplate(