Spaces:
Running
Running
Eachan Johnson
commited on
Commit
·
7dbc2af
1
Parent(s):
43cbc74
Add plotting and extra examples
Browse files- app.py +147 -24
- cache/duvida/46b7e30955f6a198.csv +5 -0
- cache/duvida/4cb06b0fe3a9d568.csv +4 -0
- cache/duvida/4e3de712acea09ab.csv +6 -0
- cache/duvida/b0211e88589b09f7.csv +7 -0
- cache/duvida/f49ecae0d0904b90.csv +7 -0
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
"""Gradio demo for schemist."""
|
2 |
|
3 |
from typing import Iterable, List, Optional, Union
|
|
|
4 |
from io import TextIOWrapper
|
5 |
import os
|
6 |
# os.environ["COMMANDLINE_ARGS"] = "--no-gradio-queue"
|
@@ -14,7 +15,6 @@ import numpy as np
|
|
14 |
import pandas as pd
|
15 |
from rdkit.Chem import Draw, Mol
|
16 |
from schemist.converting import (
|
17 |
-
_TO_FUNCTIONS,
|
18 |
_FROM_FUNCTIONS,
|
19 |
convert_string_representation,
|
20 |
_x2mol,
|
@@ -40,14 +40,19 @@ EXTRA_METRICS = {
|
|
40 |
"Information sensitivity (approx.)": lambda modelbox, candidates: modelbox.information_sensitivity(candidates=candidates, optimality_approximation=True, approximator="squared_jacobian", cache=CACHE).map(lambda x: {"information sensitivity": torch.log10(x["information sensitivity"])}),
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
def load_input_data(file: Union[TextIOWrapper, str]) -> pd.DataFrame:
|
44 |
file = file if isinstance(file, str) else file.name
|
45 |
print_err(f"Loading {file}")
|
46 |
df = read_table(file)
|
47 |
print_err(df.head())
|
48 |
-
|
49 |
-
df = gr.Dataframe(value=df, visible=True)
|
50 |
-
return df, gr.Dropdown(choices=string_cols, interactive=True, value=string_cols[0])
|
51 |
|
52 |
|
53 |
def _clean_split_input(strings: str) -> List[str]:
|
@@ -203,6 +208,7 @@ def predict_file(
|
|
203 |
extra_metrics = []
|
204 |
else:
|
205 |
extra_metrics = cast(extra_metrics, to=list)
|
|
|
206 |
prediction_df = convert_file(
|
207 |
df,
|
208 |
column=column,
|
@@ -264,8 +270,9 @@ def predict_file(
|
|
264 |
.with_format("numpy")
|
265 |
)
|
266 |
prediction_df[this_col] = this_extra[this_extra.column_names[-1]]
|
|
|
267 |
|
268 |
-
return prediction_df[['id'] + [column] + prediction_cols + ['smiles',
|
269 |
|
270 |
def draw_one(
|
271 |
strings: Union[Iterable[str], str],
|
@@ -287,6 +294,39 @@ def draw_one(
|
|
287 |
)
|
288 |
|
289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
def download_table(
|
291 |
df: pd.DataFrame
|
292 |
) -> str:
|
@@ -333,21 +373,25 @@ with gr.Blocks() as demo:
|
|
333 |
'\n'.join([
|
334 |
"C1CC1N2C=C(C(=O)C3=CC(=C(C=C32)N4CCNCC4)F)C(=O)O",
|
335 |
"CN1C(=NC(=O)C(=O)N1)SCC2=C(N3[C@@H]([C@@H](C3=O)NC(=O)/C(=N\OC)/C4=CSC(=N4)N)SC2)C(=O)O",
|
|
|
336 |
"CC(=O)NC[C@H]1CN(C(=O)O1)C2=CC(=C(C=C2)N3CCOCC3)F",
|
337 |
"C1CC2=CC(=NC=C2OC1)CNC3CCN(CC3)C[C@@H]4CN5C(=O)C=CC6=C5N4C(=O)C=N6",
|
338 |
]),
|
339 |
list(MODEL_REPOS)[0],
|
340 |
list(EXTRA_METRICS)[:2],
|
341 |
-
], # cipro, ceftriaxone, linezolid, gepotidacin
|
342 |
[
|
343 |
'\n'.join([
|
344 |
"C[C@H]1[C@H]([C@H](C[C@@H](O1)O[C@H]2C[C@@](CC3=C2C(=C4C(=C3O)C(=O)C5=C(C4=O)C(=CC=C5)OC)O)(C(=O)CO)O)N)O",
|
345 |
"CC1([C@@H](N2[C@H](S1)[C@@H](C2=O)NC(=O)[C@@H](C3=CC=CC=C3)N)C(=O)O)C",
|
346 |
"CC1([C@@H](N2[C@H](S1)[C@@H](C2=O)NC(=O)[C@@H](C3=CC=C(C=C3)O)N)C(=O)O)C",
|
|
|
|
|
|
|
347 |
]),
|
348 |
list(MODEL_REPOS)[0],
|
349 |
list(EXTRA_METRICS)[:2],
|
350 |
-
], # doxorubicin, ampicillin, amoxicillin
|
351 |
[
|
352 |
'\n'.join([
|
353 |
"C1=C(SC(=N1)SC2=NN=C(S2)N)[N+](=O)[O-]",
|
@@ -359,11 +403,36 @@ with gr.Blocks() as demo:
|
|
359 |
list(MODEL_REPOS)[0],
|
360 |
list(EXTRA_METRICS)[:2],
|
361 |
], # Halicin, Abaucin, Trimethoprim, Sulfamethoxazole, Amikacin, Isoniazid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
362 |
],
|
363 |
example_labels=[
|
364 |
-
"Ciprofloxacin, Ceftriaxone, Linezolid, Gepotidacin",
|
365 |
-
"Doxorubicin, Ampicillin, Amoxicillin",
|
366 |
-
"Halicin, Abaucin, Trimethoprim, Sulfamethoxazole, Amikacin, Isoniazid"
|
|
|
|
|
|
|
367 |
],
|
368 |
inputs=[input_line, output_species_single, extra_metric],
|
369 |
cache_mode="eager",
|
@@ -379,6 +448,7 @@ with gr.Blocks() as demo:
|
|
379 |
visible=False,
|
380 |
)
|
381 |
drawing = gr.Image(label="Chemical structures")
|
|
|
382 |
gr.on(
|
383 |
[
|
384 |
input_line.submit,
|
@@ -416,12 +486,14 @@ with gr.Blocks() as demo:
|
|
416 |
label="Input column name",
|
417 |
choices=[],
|
418 |
allow_custom_value=True,
|
|
|
419 |
)
|
420 |
input_format = gr.Dropdown(
|
421 |
label="Input string format",
|
422 |
choices=list(_FROM_FUNCTIONS),
|
423 |
value="smiles",
|
424 |
interactive=True,
|
|
|
425 |
)
|
426 |
output_species = gr.Radio(
|
427 |
label="Species for prediction",
|
@@ -435,20 +507,7 @@ with gr.Blocks() as demo:
|
|
435 |
value=list(EXTRA_METRICS)[:2],
|
436 |
interactive=True,
|
437 |
)
|
438 |
-
|
439 |
-
examples=[
|
440 |
-
[
|
441 |
-
"example-data/stokes2020-eco-1000.csv",
|
442 |
-
"SMILES",
|
443 |
-
"Klebsiella pneumoniae",
|
444 |
-
list(EXTRA_METRICS)[:2]],
|
445 |
-
],
|
446 |
-
example_labels=[
|
447 |
-
"Stokes J. et al., Cell, 2020"
|
448 |
-
],
|
449 |
-
inputs=[input_file, input_column, output_species, extra_metric_file],
|
450 |
-
cache_mode="eager",
|
451 |
-
)
|
452 |
go_button2 = gr.Button(
|
453 |
value="Predict!",
|
454 |
)
|
@@ -463,6 +522,48 @@ with gr.Blocks() as demo:
|
|
463 |
visible=False,
|
464 |
interactive=False,
|
465 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
file_examples.load_input_event.then(
|
468 |
load_input_data,
|
@@ -490,6 +591,28 @@ with gr.Blocks() as demo:
|
|
490 |
download_table,
|
491 |
inputs=input_data,
|
492 |
outputs=download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
)
|
494 |
|
495 |
if __name__ == "__main__":
|
|
|
1 |
"""Gradio demo for schemist."""
|
2 |
|
3 |
from typing import Iterable, List, Optional, Union
|
4 |
+
from functools import partial
|
5 |
from io import TextIOWrapper
|
6 |
import os
|
7 |
# os.environ["COMMANDLINE_ARGS"] = "--no-gradio-queue"
|
|
|
15 |
import pandas as pd
|
16 |
from rdkit.Chem import Draw, Mol
|
17 |
from schemist.converting import (
|
|
|
18 |
_FROM_FUNCTIONS,
|
19 |
convert_string_representation,
|
20 |
_x2mol,
|
|
|
40 |
"Information sensitivity (approx.)": lambda modelbox, candidates: modelbox.information_sensitivity(candidates=candidates, optimality_approximation=True, approximator="squared_jacobian", cache=CACHE).map(lambda x: {"information sensitivity": torch.log10(x["information sensitivity"])}),
|
41 |
}
|
42 |
|
43 |
+
def get_dropdown_options(df, _type = str):
|
44 |
+
if _type == str:
|
45 |
+
cols = list(df.select_dtypes(exclude=[np.number]))
|
46 |
+
else:
|
47 |
+
cols = list(df.select_dtypes([np.number]))
|
48 |
+
return gr.Dropdown(choices=cols, interactive=True, value=cols[0], visible=True)
|
49 |
+
|
50 |
def load_input_data(file: Union[TextIOWrapper, str]) -> pd.DataFrame:
|
51 |
file = file if isinstance(file, str) else file.name
|
52 |
print_err(f"Loading {file}")
|
53 |
df = read_table(file)
|
54 |
print_err(df.head())
|
55 |
+
return gr.Dataframe(value=df, visible=True), get_dropdown_options(df, str)
|
|
|
|
|
56 |
|
57 |
|
58 |
def _clean_split_input(strings: str) -> List[str]:
|
|
|
208 |
extra_metrics = []
|
209 |
else:
|
210 |
extra_metrics = cast(extra_metrics, to=list)
|
211 |
+
|
212 |
prediction_df = convert_file(
|
213 |
df,
|
214 |
column=column,
|
|
|
270 |
.with_format("numpy")
|
271 |
)
|
272 |
prediction_df[this_col] = this_extra[this_extra.column_names[-1]]
|
273 |
+
other_cols = [col for col in prediction_df if col not in ['id', 'inchikey', 'smiles', "mwt", "clogp"] + [column] + prediction_cols]
|
274 |
|
275 |
+
return prediction_df[['id', 'inchikey'] + [column] + prediction_cols + other_cols + ['smiles', "mwt", "clogp"]]
|
276 |
|
277 |
def draw_one(
|
278 |
strings: Union[Iterable[str], str],
|
|
|
294 |
)
|
295 |
|
296 |
|
297 |
+
def plot_pred_vs_observed(
|
298 |
+
df,
|
299 |
+
species: str,
|
300 |
+
observed: str,
|
301 |
+
color: Optional[str] = None,
|
302 |
+
):
|
303 |
+
print_err(df.head())
|
304 |
+
xcol = f"{species}: predicted MIC (µM)"
|
305 |
+
ycol = observed
|
306 |
+
y_title = f"Observed ({ycol})"
|
307 |
+
cols = ["id", "inchikey", "smiles", "mwt", "clogp", xcol, ycol]
|
308 |
+
color_title = color
|
309 |
+
if color is not None and color not in cols:
|
310 |
+
cols.append(color)
|
311 |
+
cols = list(set(cols))
|
312 |
+
print_err(df[cols].columns)
|
313 |
+
if np.all(df[xcol] > 0):
|
314 |
+
df[xcol] = np.log10(df[xcol])
|
315 |
+
x_title = f"Predicted log10[MIC(µM)]"
|
316 |
+
|
317 |
+
return gr.ScatterPlot(
|
318 |
+
value=df[cols],
|
319 |
+
x=xcol,
|
320 |
+
y=ycol,
|
321 |
+
color=color,
|
322 |
+
x_title=x_title,
|
323 |
+
y_title=y_title,
|
324 |
+
color_title=color_title,
|
325 |
+
tooltip="all",
|
326 |
+
visible=True,
|
327 |
+
)
|
328 |
+
|
329 |
+
|
330 |
def download_table(
|
331 |
df: pd.DataFrame
|
332 |
) -> str:
|
|
|
373 |
'\n'.join([
|
374 |
"C1CC1N2C=C(C(=O)C3=CC(=C(C=C32)N4CCNCC4)F)C(=O)O",
|
375 |
"CN1C(=NC(=O)C(=O)N1)SCC2=C(N3[C@@H]([C@@H](C3=O)NC(=O)/C(=N\OC)/C4=CSC(=N4)N)SC2)C(=O)O",
|
376 |
+
"CC(C)(C(=O)O)O/N=C(/C1=CSC(=N1)N)\C(=O)N[C@H]2[C@@H]3N(C2=O)C(=C(CS3)C[N+]4(CCCC4)CCNC(=O)C5=C(C(=C(C=C5)O)O)Cl)C(=O)[O-]",
|
377 |
"CC(=O)NC[C@H]1CN(C(=O)O1)C2=CC(=C(C=C2)N3CCOCC3)F",
|
378 |
"C1CC2=CC(=NC=C2OC1)CNC3CCN(CC3)C[C@@H]4CN5C(=O)C=CC6=C5N4C(=O)C=N6",
|
379 |
]),
|
380 |
list(MODEL_REPOS)[0],
|
381 |
list(EXTRA_METRICS)[:2],
|
382 |
+
], # cipro, ceftriaxone, cefiderocol, linezolid, gepotidacin
|
383 |
[
|
384 |
'\n'.join([
|
385 |
"C[C@H]1[C@H]([C@H](C[C@@H](O1)O[C@H]2C[C@@](CC3=C2C(=C4C(=C3O)C(=O)C5=C(C4=O)C(=CC=C5)OC)O)(C(=O)CO)O)N)O",
|
386 |
"CC1([C@@H](N2[C@H](S1)[C@@H](C2=O)NC(=O)[C@@H](C3=CC=CC=C3)N)C(=O)O)C",
|
387 |
"CC1([C@@H](N2[C@H](S1)[C@@H](C2=O)NC(=O)[C@@H](C3=CC=C(C=C3)O)N)C(=O)O)C",
|
388 |
+
"C[C@@H]1[C@@H]2[C@H](C(=O)N2C(=C1S[C@H]3C[C@H](NC3)C(=O)N(C)C)C(=O)O)[C@@H](C)O",
|
389 |
+
"C[C@@]1([C@H]2C[C@H]3[C@@H](C(=O)C(=C([C@]3(C(=O)C2=C(C4=C1C=CC=C4O)O)O)O)C(=O)N)N(C)C)O",
|
390 |
+
"CC1=C2C=CC=C(C2=C(C3=C1C[C@H]4[C@@H](C(=O)C(=C([C@]4(C3=O)O)O)C(=O)N)N(C)C)O)O",
|
391 |
]),
|
392 |
list(MODEL_REPOS)[0],
|
393 |
list(EXTRA_METRICS)[:2],
|
394 |
+
], # doxorubicin, ampicillin, amoxicillin, meropenem, tetracycline, anhydrotetracycline
|
395 |
[
|
396 |
'\n'.join([
|
397 |
"C1=C(SC(=N1)SC2=NN=C(S2)N)[N+](=O)[O-]",
|
|
|
403 |
list(MODEL_REPOS)[0],
|
404 |
list(EXTRA_METRICS)[:2],
|
405 |
], # Halicin, Abaucin, Trimethoprim, Sulfamethoxazole, Amikacin, Isoniazid
|
406 |
+
[
|
407 |
+
'\n'.join([
|
408 |
+
"CC[C@H](C)[C@H]1C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N[C@H](C(=O)N2CCC[C@@H]2C(=O)N3CCC[C@H]3C(=O)N[C@H](C(=O)N[C@H](C(=O)N1)CC4=CNC5=CC=CC=C54)[C@@H](C)O)CO)C)CCN)CCN)CC6=CNC7=CC=CC=C76)CCN)CCN)CCCN)CCN",
|
409 |
+
"C[C@H]1[C@H]([C@@](C[C@@H](O1)O[C@@H]2[C@H]([C@@H]([C@H](O[C@H]2OC3=C4C=C5C=C3OC6=C(C=C(C=C6)[C@H]([C@H](C(=O)N[C@H](C(=O)N[C@H]5C(=O)N[C@@H]7C8=CC(=C(C=C8)O)C9=C(C=C(C=C9O)O)[C@H](NC(=O)[C@H]([C@@H](C1=CC(=C(O4)C=C1)Cl)O)NC7=O)C(=O)O)CC(=O)N)NC(=O)[C@@H](CC(C)C)NC)O)Cl)CO)O)O)(C)N)O",
|
410 |
+
"CN1[C@H](C(=O)NCC2=C(C=CC=C2SC3=C(CN[C@H](C(=O)N[C@H](C1=O)CCCCN)CCCN)C=CC=N3)C4=CC=C(C=C4)C(=O)O)CC5=CNC6=CC=CC=C65",
|
411 |
+
"C[C@@]1(CO[C@@H]([C@@H]([C@H]1NC)O)O[C@H]2[C@@H](C[C@@H]([C@H]([C@@H]2O)O[C@@H]3[C@@H](CC=C(O3)CNCCO)N)N)NC(=O)[C@H](CCN)O)O",
|
412 |
+
"CC(C1CCC(C(O1)OC2C(CC(C(C2O)OC3C(C(C(CO3)(C)O)NC)O)N)N)N)NC",
|
413 |
+
"C[C@H]1/C=C/C=C(\C(=O)NC2=C(C(=C3C(=C2O)C(=C(C4=C3C(=O)[C@](O4)(O/C=C/[C@@H]([C@H]([C@H]([C@@H]([C@@H]([C@@H]([C@H]1O)C)O)C)OC(=O)C)C)OC)C)C)O)O)/C=N/N5CCN(CC5)C)/C",
|
414 |
+
]),
|
415 |
+
list(MODEL_REPOS)[0],
|
416 |
+
list(EXTRA_METRICS)[:2],
|
417 |
+
], # murepavadin, vancomycin, zosurabalpin, plazomicin, Gentamicin, rifampicin
|
418 |
+
[
|
419 |
+
'\n'.join([
|
420 |
+
"CC1=C(OC2=CC=CC=C12)CN(C)C(=O)/C=C/C3=CC4=C(NC(=O)CC4)N=C3",
|
421 |
+
"CC1=C(OC2=CC=CC=C12)CN(C)C(=O)/C=C/C3=CC4=C(NC(=O)[C@@H](C4)N)N=C3",
|
422 |
+
"CC1=C(OC2=CC=CC=C12)CN(C)C(=O)/C=C/C3=CC4=C(NC(=O)[C@H](CC4)[NH3+])N=C3.[Cl-]",
|
423 |
+
]),
|
424 |
+
list(MODEL_REPOS)[0],
|
425 |
+
list(EXTRA_METRICS)[:2],
|
426 |
+
], # Debio1452, Debio-1452-NH3, Fabimycin,
|
427 |
+
|
428 |
],
|
429 |
example_labels=[
|
430 |
+
"Ciprofloxacin, Ceftriaxone, Cefiderocol, Linezolid, Gepotidacin",
|
431 |
+
"Doxorubicin, Ampicillin, Amoxicillin, Meropenem, Tetracycline, Anhydrotetracycline",
|
432 |
+
"Halicin, Abaucin, Trimethoprim, Sulfamethoxazole, Amikacin, Isoniazid",
|
433 |
+
"Murepavadin, Vancomycin, Zosurabalpin, Plazomicin, Gentamicin, Rifampicin",
|
434 |
+
"Debio-1452, Debio-1452-NH3, Fabimycin",
|
435 |
+
|
436 |
],
|
437 |
inputs=[input_line, output_species_single, extra_metric],
|
438 |
cache_mode="eager",
|
|
|
448 |
visible=False,
|
449 |
)
|
450 |
drawing = gr.Image(label="Chemical structures")
|
451 |
+
|
452 |
gr.on(
|
453 |
[
|
454 |
input_line.submit,
|
|
|
486 |
label="Input column name",
|
487 |
choices=[],
|
488 |
allow_custom_value=True,
|
489 |
+
visible=False,
|
490 |
)
|
491 |
input_format = gr.Dropdown(
|
492 |
label="Input string format",
|
493 |
choices=list(_FROM_FUNCTIONS),
|
494 |
value="smiles",
|
495 |
interactive=True,
|
496 |
+
visible=True,
|
497 |
)
|
498 |
output_species = gr.Radio(
|
499 |
label="Species for prediction",
|
|
|
507 |
value=list(EXTRA_METRICS)[:2],
|
508 |
interactive=True,
|
509 |
)
|
510 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
go_button2 = gr.Button(
|
512 |
value="Predict!",
|
513 |
)
|
|
|
522 |
visible=False,
|
523 |
interactive=False,
|
524 |
)
|
525 |
+
with gr.Row():
|
526 |
+
observed_col = gr.Dropdown(
|
527 |
+
label="Observed column (y-axis) for comparison plot",
|
528 |
+
choices=[],
|
529 |
+
value=None,
|
530 |
+
interactive=True,
|
531 |
+
visible=False,
|
532 |
+
)
|
533 |
+
color_col = gr.Dropdown(
|
534 |
+
label="Color for comparison plot",
|
535 |
+
choices=[],
|
536 |
+
value=None,
|
537 |
+
interactive=True,
|
538 |
+
visible=False,
|
539 |
+
)
|
540 |
+
plot_button = gr.Button(
|
541 |
+
value="Plot!",
|
542 |
+
visible=False,
|
543 |
+
)
|
544 |
+
file_examples = gr.Examples(
|
545 |
+
examples=[
|
546 |
+
[
|
547 |
+
"example-data/stokes2020-eco-1000.csv",
|
548 |
+
"SMILES",
|
549 |
+
"Klebsiella pneumoniae",
|
550 |
+
"Mean_Inhibition",
|
551 |
+
"Klebsiella pneumoniae: Doubtscore",
|
552 |
+
list(EXTRA_METRICS)[:3]],
|
553 |
+
],
|
554 |
+
example_labels=[
|
555 |
+
"Stokes J. et al., Cell, 2020",
|
556 |
+
],
|
557 |
+
inputs=[input_file, input_column, output_species, observed_col, color_col, extra_metric_file],
|
558 |
+
cache_mode="eager",
|
559 |
+
)
|
560 |
+
pred_vs_observed = gr.ScatterPlot(
|
561 |
+
label="Prediction vs observed",
|
562 |
+
x_title="Predicted MIC (µM)",
|
563 |
+
y_title="Observed",
|
564 |
+
visible=False,
|
565 |
+
height=600,
|
566 |
+
)
|
567 |
|
568 |
file_examples.load_input_event.then(
|
569 |
load_input_data,
|
|
|
591 |
download_table,
|
592 |
inputs=input_data,
|
593 |
outputs=download
|
594 |
+
).then(
|
595 |
+
partial(get_dropdown_options, _type="number"),
|
596 |
+
inputs=[input_data],
|
597 |
+
outputs=[observed_col],
|
598 |
+
).then(
|
599 |
+
partial(get_dropdown_options, _type="number"),
|
600 |
+
inputs=[input_data],
|
601 |
+
outputs=[color_col],
|
602 |
+
).then(
|
603 |
+
lambda: gr.Button(visible=True),
|
604 |
+
outputs=[plot_button],
|
605 |
+
)
|
606 |
+
|
607 |
+
plot_button.click(
|
608 |
+
plot_pred_vs_observed,
|
609 |
+
inputs=[
|
610 |
+
input_data,
|
611 |
+
output_species,
|
612 |
+
observed_col,
|
613 |
+
color_col,
|
614 |
+
],
|
615 |
+
outputs=pred_vs_observed,
|
616 |
)
|
617 |
|
618 |
if __name__ == "__main__":
|
cache/duvida/46b7e30955f6a198.csv
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
id,pubchem_name,pubchem_id,smiles,inchikey,mwt,clogp,pmic
|
2 |
+
55907057,doxorubicin,31703,COc1cccc2c1C(=O)c1c(O)c3c(c(O)c1C2=O)C[C@@](O)(C(=O)CO)C[C@@H]3O[C@H]1C[C@H](N)[C@H](O)[C@H](C)O1,AOJJSUZBOXZQNB-TZSSRYMLSA-N,543.1740607479999,0.0012999999999995793,
|
3 |
+
39882995,ampicillin,6249,CC1(C)S[C@@H]2[C@H](NC(=O)[C@H](N)c3ccccc3)C(=O)N2[C@H]1C(=O)O,AVKUERGKIZMTKX-NJBDSQKTSA-N,349.109627088,0.3180999999999994,
|
4 |
+
32459081,amoxicillin,33613,CC1(C)S[C@@H]2[C@H](NC(=O)[C@H](N)c3ccc(O)cc3)C(=O)N2[C@H]1C(=O)O,LSQZJLSUYDQPKJ-NJBDSQKTSA-N,365.104541708,0.023699999999999555,
|
5 |
+
83758219,meropenem,441130,C[C@@H](O)[C@H]1C(=O)N2C(C(=O)O)=C(S[C@@H]3CN[C@H](C(=O)N(C)C)C3)[C@H](C)[C@H]12,DMJNNHOOLUXYBV-PQTSNVLCSA-N,383.15149189999994,-0.30799999999999755,
|
cache/duvida/4cb06b0fe3a9d568.csv
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
id,pubchem_name,pubchem_id,smiles,inchikey,mwt,clogp,pmic
|
2 |
+
11006647,api-1252;debio 1452,66780180,Cc1c(CN(C)C(=O)/C=C/c2cnc3c(c2)CCC(=O)N3)oc2ccccc12,QXTWSUQCXCWEHF-UHFFFAOYSA-N,375.1582915320001,3.6927200000000013,
|
3 |
+
92538103,,,Cc1c(CN(C)C(=O)/C=C/c2cnc3c(c2)C[C@@H](N)C(=O)N3)oc2ccccc12,AEHIWLAQKTVLCP-QGZVFWFLSA-N,390.1691905640001,2.6299199999999994,
|
4 |
+
86029193,,,Cc1c(CN(C)C(=O)/C=C/c2cnc3c(c2)CC[C@H]([NH3+])C(=O)N3)oc2ccccc12.[Cl-],FCJIJHAQWMWXOH-FERBBOLQSA-N,440.1615183400001,-0.6927799999999977,
|
cache/duvida/4e3de712acea09ab.csv
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
id,pubchem_name,pubchem_id,smiles,inchikey,mwt,clogp,pmic
|
2 |
+
59856225,ciprofloxacin,2764,O=C(O)c1cn(C2CC2)c2cc(N3CCNCC3)c(F)cc2c1=O,MYSWGUAQZAJSOK-UHFFFAOYSA-N,331.13321965599994,1.5833,
|
3 |
+
37063130,"ceftriaxone,(s)",51800,CO/N=C(\C(=O)N[C@@H]1C(=O)N2C(C(=O)O)=C(CSc3nc(=O)c(=O)[nH]n3C)CS[C@H]12)c1csc(N)n1,VAAUVRVFOQPIGI-RFAUZJTJSA-N,554.0460579160002,-1.6112999999999957,
|
4 |
+
11207513,cefiderocol,77843966,CC(C)(O/N=C(\C(=O)N[C@@H]1C(=O)N2C(C(=O)[O-])=C(C[N+]3(CCNC(=O)c4ccc(O)c(O)c4Cl)CCCC3)CS[C@H]12)c1csc(N)n1)C(=O)O,DBPPRLRVDVJOCL-FQRUVTKNSA-N,751.1497099680003,-0.1816999999999978,
|
5 |
+
70621966,linezolid,441401,CC(=O)NC[C@H]1CN(c2ccc(N3CCOCC3)c(F)c2)C(=O)O1,TYZROVQLWOKYKF-ZDUSSCGKSA-N,337.14378433999997,1.1235999999999995,
|
6 |
+
40634032,gepotidacin,25101874,O=c1ccc2ncc(=O)n3c2n1C[C@H]3CN1CCC(NCc2cc3c(cn2)OCCC3)CC1,PZFAZQUREQIODZ-LJQANCHMSA-N,448.222288756,1.0870999999999995,
|
cache/duvida/b0211e88589b09f7.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
id,pubchem_name,pubchem_id,smiles,inchikey,mwt,clogp,pmic
|
2 |
+
55907057,doxorubicin,31703,COc1cccc2c1C(=O)c1c(O)c3c(c(O)c1C2=O)C[C@@](O)(C(=O)CO)C[C@@H]3O[C@H]1C[C@H](N)[C@H](O)[C@H](C)O1,AOJJSUZBOXZQNB-TZSSRYMLSA-N,543.1740607479999,0.0012999999999995793,
|
3 |
+
39882995,ampicillin,6249,CC1(C)S[C@@H]2[C@H](NC(=O)[C@H](N)c3ccccc3)C(=O)N2[C@H]1C(=O)O,AVKUERGKIZMTKX-NJBDSQKTSA-N,349.109627088,0.3180999999999994,
|
4 |
+
32459081,amoxicillin,33613,CC1(C)S[C@@H]2[C@H](NC(=O)[C@H](N)c3ccc(O)cc3)C(=O)N2[C@H]1C(=O)O,LSQZJLSUYDQPKJ-NJBDSQKTSA-N,365.104541708,0.023699999999999555,
|
5 |
+
83758219,meropenem,441130,C[C@@H](O)[C@H]1C(=O)N2C(C(=O)O)=C(S[C@@H]3CN[C@H](C(=O)N(C)C)C3)[C@H](C)[C@H]12,DMJNNHOOLUXYBV-PQTSNVLCSA-N,383.15149189999994,-0.30799999999999755,
|
6 |
+
88220429,tetracycline zwitterion,51580080,CN(C)[C@@H]1C(=O)C(C(N)=O)=C(O)[C@@]2(O)C(=O)C3=C(O)c4c(O)cccc4[C@@](C)(O)[C@H]3C[C@@H]12,NWXMGUDVXFXRIG-WESIUVDSSA-N,444.1532657279999,-0.37099999999999905,
|
7 |
+
87836778,"(1s,4as,12as)-3-carbamoyl-1-(dimethylammonio)-4a,6,7-trihydroxy-11-methyl-4,5-dioxo-1,4,4a,5,12,12a-hexahydrotetracen-2-olate",51527838,Cc1c2c(c(O)c3c(O)cccc13)C(=O)[C@]1(O)C(O)=C(C(N)=O)C(=O)[C@@H](N(C)C)[C@@H]1C2,KTTKGQINVKPHLY-DOCRCCHOSA-N,426.1427010439999,0.4558200000000004,
|
cache/duvida/f49ecae0d0904b90.csv
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
id,pubchem_name,pubchem_id,smiles,inchikey,mwt,clogp,pmic
|
2 |
+
81021875,murepavadin,91824766,CC[C@H](C)[C@@H]1NC(=O)[C@H](Cc2c[nH]c3ccccc23)NC(=O)[C@H]([C@@H](C)O)NC(=O)[C@@H]2CCCN2C(=O)[C@H]2CCCN2C(=O)[C@H](CO)NC(=O)[C@H](C)NC(=O)[C@H](CCN)NC(=O)[C@H](CCN)NC(=O)[C@H](Cc2c[nH]c3ccccc23)NC(=O)[C@H](CCN)NC(=O)[C@@H](CCN)NC(=O)[C@H](CCCN)NC(=O)[C@H](CCN)NC1=O,RIDRXGOBXZLKHZ-NZUANIILSA-N,1552.8626655039996,-6.830399999999926,
|
3 |
+
10403696,vancomycin,14969,CN[C@H](CC(C)C)C(=O)N[C@H]1C(=O)N[C@@H](CC(N)=O)C(=O)N[C@H]2C(=O)N[C@H]3C(=O)N[C@H](C(=O)N[C@H](C(=O)O)c4cc(O)cc(O)c4-c4cc3ccc4O)[C@H](O)c3ccc(c(Cl)c3)Oc3cc2cc(c3O[C@@H]2O[C@H](CO)[C@@H](O)[C@H](O)[C@H]2O[C@H]2C[C@](C)(N)[C@H](O)[C@H](C)O2)Oc2ccc(cc2Cl)[C@H]1O,MYPYJXKWCTUITO-LYRMYLQWSA-N,1447.4301996399995,0.10620000000000607,
|
4 |
+
60220333,zosurabalpin,148636827,CN1C(=O)[C@H](CCCCN)NC(=O)[C@H](CCCN)NCc2cccnc2Sc2cccc(-c3ccc(C(=O)O)cc3)c2CNC(=O)[C@@H]1Cc1c[nH]c2ccccc12,NJFUXFYUHIHHOJ-FSEITFBQSA-N,790.3624877000001,4.589700000000004,
|
5 |
+
56471460,plazomicin,42613186,CN[C@@H]1[C@@H](O)[C@@H](O[C@@H]2[C@@H](O)[C@H](O[C@H]3OC(CNCCO)=CC[C@H]3N)[C@@H](N)C[C@H]2NC(=O)[C@@H](O)CCN)OC[C@]1(C)O,IYDYFVUFSPQPPV-PEXOCOHZSA-N,592.3431917360001,-5.361100000000008,
|
6 |
+
17334639,gentamicin,3467,CNC(C)C1CCC(N)C(OC2C(N)CC(N)C(OC3OCC(C)(O)C(NC)C3O)C2O)O1,CEAZRRDELHUEMR-UHFFFAOYSA-N,477.3162487160001,-3.3274999999999926,
|
7 |
+
69369645,"[(7s,11s,12r,13s,14r,15r,16r,17s,18s)-2,15,17,27,29-pentahydroxy-11-methoxy-3,7,12,14,16,18,22-heptamethyl-26-[(4-methylpiperazin-1-yl)iminomethyl]-6,23-dioxo-8,30-dioxa-24-azatetracyclo[23.3.1.14,7.05,28]triaconta-1(29),2,4,9,19,21,25,27-octaen-13-yl] acetate",135449527,CO[C@H]1/C=C/O[C@@]2(C)Oc3c(C)c(O)c4c(O)c(c(/C=N/N5CCN(C)CC5)c(O)c4c3C2=O)NC(=O)/C(C)=C\C=C\[C@H](C)[C@H](O)[C@@H](C)[C@@H](O)[C@@H](C)[C@H](OC(C)=O)[C@@H]1C,JQXXHWHPUNPDRT-GHGVGPBWSA-N,822.4051232959999,4.3354200000000045,
|