Eachan Johnson commited on
Commit
36929a8
·
1 Parent(s): 39d7314

Update examples, fix plot issue missing smiles column

Browse files
app.py CHANGED
@@ -292,18 +292,28 @@ def predict_file(
292
  predict=predict,
293
  extra_metrics=extra_metrics,
294
  )
 
 
295
  main_cols = set(
296
- ['id', 'inchikey', 'smiles', "mwt", "clogp"]
 
297
  + [column]
298
  + prediction_cols
299
  )
300
  other_cols = list(set(prediction_df) - main_cols)
301
- prediction_df = prediction_df[
302
- ['id', 'inchikey']
303
  + [column]
304
- + prediction_cols + other_cols
305
- + ["mwt", "clogp"]
306
- ]
 
 
 
 
 
 
 
307
  plot_dropdown = get_dropdown_options(prediction_df, _type="number")
308
  plot_dropdown = (plot_dropdown,) * 5
309
  gradio_opts = {
 
292
  predict=predict,
293
  extra_metrics=extra_metrics,
294
  )
295
+ left_cols = ['id', 'inchikey']
296
+ end_cols = ["smiles", "mwt", "clogp"]
297
  main_cols = set(
298
+ left_cols
299
+ + end_cols
300
  + [column]
301
  + prediction_cols
302
  )
303
  other_cols = list(set(prediction_df) - main_cols)
304
+ return_cols = (
305
+ left_cols
306
  + [column]
307
+ + prediction_cols
308
+ + other_cols
309
+ + end_cols
310
+ )
311
+ deduplicated_cols = []
312
+ for col in return_cols:
313
+ if not col in deduplicated_cols:
314
+ deduplicated_cols.append(col)
315
+ prediction_df = prediction_df[deduplicated_cols]
316
+
317
  plot_dropdown = get_dropdown_options(prediction_df, _type="number")
318
  plot_dropdown = (plot_dropdown,) * 5
319
  gradio_opts = {
example-data/liu23-abau-1000.csv CHANGED
The diff for this file is too large to render. See raw diff
 
example-data/stokes20-eco-1000.csv CHANGED
The diff for this file is too large to render. See raw diff
 
example-data/wong24-sau-tox-1000.csv CHANGED
The diff for this file is too large to render. See raw diff
 
scripts/prep-examples.sh CHANGED
@@ -28,4 +28,6 @@ set -x
28
 
29
  pandas '[['"$FIELDS"']].sample('"$NLINES"')' \
30
  < "$INPUT" \
 
 
31
  > "$OUTPUT"
 
28
 
29
  pandas '[['"$FIELDS"']].sample('"$NLINES"')' \
30
  < "$INPUT" \
31
+ | schemist convert -c SMILES -2 id pubchem_id pubchem_name -f CSV \
32
+ | pandas '.sort_values(["id"])' \
33
  > "$OUTPUT"