libokj commited on
Commit
608195e
·
1 Parent(s): f71404f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -1113,6 +1113,10 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1113
  category = None
1114
  columns_unique = None
1115
 
 
 
 
 
1116
  if 'Compound' in df_html.columns and 'Exclude Molecular Graph' not in opts:
1117
  df_html['Compound'] = df_html['Compound'].parallel_apply(
1118
  lambda x: PandasTools.PrintAsImageString(x) if not pd.isna(x) else x)
@@ -1172,6 +1176,10 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1172
  lambda x: wrap_text(x) if not pd.isna(x) else x)
1173
  if 'Scaffold SMILES' in df_html.columns:
1174
  df_html.drop(['Scaffold SMILES'], axis=1, inplace=True)
 
 
 
 
1175
  styled_df = df_html.fillna('').style.format(precision=3)
1176
 
1177
  for i, col in enumerate(num_cols):
@@ -1206,10 +1214,6 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1206
  f'<div style="overflow:auto; height: 300px; font-family: Courier !important;">{table_html}</div>')
1207
 
1208
  else:
1209
- if 'Exclude Pharmacophore 3D' not in opts:
1210
- df_html['Pharmacophore'] = df_html['Compound'].parallel_apply(
1211
- lambda x: mol_to_pharm3d(x) if not pd.isna(x) else x)
1212
-
1213
  image_zoom_formatter = HTMLTemplateFormatter(template='<div class="image-zoom-viewer"><%= value %></div>')
1214
  uniprot_id_formatter = HTMLTemplateFormatter(
1215
  template='<% if (value == value) { ' # Check if value is not NaN
@@ -1234,8 +1238,8 @@ def create_html_report(df, file=None, task=None, opts=(), progress=gr.Progress(t
1234
  'Target FASTA': {'type': 'textarea', 'width': 60},
1235
  'Target ID': uniprot_id_formatter,
1236
  'Compound ID': pubchem_id_formatter,
1237
- 'Max. Tanimoto Similarity Target Ligand': uniprot_id_formatter,
1238
- 'Max. Sequence Identity Ligand Target': pubchem_id_formatter,
1239
  }
1240
  formatters = {**bool_formatters, **float_formatters, **other_formatters}
1241
 
 
1113
  category = None
1114
  columns_unique = None
1115
 
1116
+ if 'Exclude Pharmacophore 3D' not in opts:
1117
+ df_html['Pharmacophore'] = df_html['Compound'].parallel_apply(
1118
+ lambda x: mol_to_pharm3d(x) if not pd.isna(x) else x)
1119
+
1120
  if 'Compound' in df_html.columns and 'Exclude Molecular Graph' not in opts:
1121
  df_html['Compound'] = df_html['Compound'].parallel_apply(
1122
  lambda x: PandasTools.PrintAsImageString(x) if not pd.isna(x) else x)
 
1176
  lambda x: wrap_text(x) if not pd.isna(x) else x)
1177
  if 'Scaffold SMILES' in df_html.columns:
1178
  df_html.drop(['Scaffold SMILES'], axis=1, inplace=True)
1179
+ # FIXME: Temporarily drop pharmacophore column before an image solution is found
1180
+ if 'Pharmacophore' in df_html.columns:
1181
+ df_html.drop(['Pharmacophore'], axis=1, inplace=True)
1182
+
1183
  styled_df = df_html.fillna('').style.format(precision=3)
1184
 
1185
  for i, col in enumerate(num_cols):
 
1214
  f'<div style="overflow:auto; height: 300px; font-family: Courier !important;">{table_html}</div>')
1215
 
1216
  else:
 
 
 
 
1217
  image_zoom_formatter = HTMLTemplateFormatter(template='<div class="image-zoom-viewer"><%= value %></div>')
1218
  uniprot_id_formatter = HTMLTemplateFormatter(
1219
  template='<% if (value == value) { ' # Check if value is not NaN
 
1238
  'Target FASTA': {'type': 'textarea', 'width': 60},
1239
  'Target ID': uniprot_id_formatter,
1240
  'Compound ID': pubchem_id_formatter,
1241
+ 'Max. Tanimoto Similarity Target Ligand': pubchem_id_formatter,
1242
+ 'Max. Sequence Identity Ligand Target': uniprot_id_formatter,
1243
  }
1244
  formatters = {**bool_formatters, **float_formatters, **other_formatters}
1245