Spaces:
Running
Running
jannisborn
commited on
update
Browse files- app.py +9 -11
- model_cards/article.md +8 -3
app.py
CHANGED
@@ -30,19 +30,13 @@ def run_inference(
|
|
30 |
confidence: bool,
|
31 |
):
|
32 |
|
33 |
-
print(smiles)
|
34 |
-
print(smiles_path)
|
35 |
# Read SMILES
|
36 |
-
if not isinstance(smiles_path, (str, type(None))):
|
37 |
-
raise TypeError(
|
38 |
-
f"SMILES file pass has to be None or str, not {type(smiles_path)}"
|
39 |
-
)
|
40 |
if smiles is None and smiles_path is None:
|
41 |
raise TypeError("Pass either single SMILES or a file")
|
42 |
elif smiles is not None:
|
43 |
smiles = [smiles]
|
44 |
elif smiles_path is not None:
|
45 |
-
smiles_data = pd.read_csv(smiles_path, sep="\t", header=
|
46 |
smiles = smiles_data[0]
|
47 |
for smi in smiles:
|
48 |
if Chem.MolFromSmiles(smi) is None:
|
@@ -93,6 +87,10 @@ def run_inference(
|
|
93 |
)
|
94 |
df["site"] = df["site"].apply(lambda x: site_mapper.get(x, x))
|
95 |
df["cell_line"] = df["cell_line"].apply(lambda x: x.split("_")[0])
|
|
|
|
|
|
|
|
|
96 |
else:
|
97 |
pass
|
98 |
|
@@ -113,9 +111,9 @@ if __name__ == "__main__":
|
|
113 |
metadata_root = pathlib.Path(__file__).parent.joinpath("model_cards")
|
114 |
|
115 |
examples = [
|
116 |
-
["COc1cc(O)c2c(c1)C=CCC(O)C(O)C(=O)C=CCC(C)OC2=O",
|
117 |
-
["COC1=C(C=C2C(=C1)N=CN=C2NC3=CC(=C(C=C3)F)Cl)OCCCN4CCOCC4",
|
118 |
-
[
|
119 |
]
|
120 |
with open(metadata_root.joinpath("article.md"), "r") as f:
|
121 |
article = f.read()
|
@@ -133,7 +131,7 @@ if __name__ == "__main__":
|
|
133 |
),
|
134 |
gr.File(
|
135 |
file_types=[".smi", ".tsv"],
|
136 |
-
label="
|
137 |
),
|
138 |
gr.File(
|
139 |
file_types=[".csv"],
|
|
|
30 |
confidence: bool,
|
31 |
):
|
32 |
|
|
|
|
|
33 |
# Read SMILES
|
|
|
|
|
|
|
|
|
34 |
if smiles is None and smiles_path is None:
|
35 |
raise TypeError("Pass either single SMILES or a file")
|
36 |
elif smiles is not None:
|
37 |
smiles = [smiles]
|
38 |
elif smiles_path is not None:
|
39 |
+
smiles_data = pd.read_csv(smiles_path.name, sep="\t", header=None)
|
40 |
smiles = smiles_data[0]
|
41 |
for smi in smiles:
|
42 |
if Chem.MolFromSmiles(smi) is None:
|
|
|
87 |
)
|
88 |
df["site"] = df["site"].apply(lambda x: site_mapper.get(x, x))
|
89 |
df["cell_line"] = df["cell_line"].apply(lambda x: x.split("_")[0])
|
90 |
+
if confidence:
|
91 |
+
df.drop(
|
92 |
+
["aleatoric_confidence", "epistemic_confidence"], axis=1, inplace=True
|
93 |
+
)
|
94 |
else:
|
95 |
pass
|
96 |
|
|
|
111 |
metadata_root = pathlib.Path(__file__).parent.joinpath("model_cards")
|
112 |
|
113 |
examples = [
|
114 |
+
["COc1cc(O)c2c(c1)C=CCC(O)C(O)C(=O)C=CCC(C)OC2=O", None, None, False],
|
115 |
+
["COC1=C(C=C2C(=C1)N=CN=C2NC3=CC(=C(C=C3)F)Cl)OCCCN4CCOCC4", None, None, True],
|
116 |
+
[None, metadata_root.joinpath("molecules.smi"), None, False],
|
117 |
]
|
118 |
with open(metadata_root.joinpath("article.md"), "r") as f:
|
119 |
article = f.read()
|
|
|
131 |
),
|
132 |
gr.File(
|
133 |
file_types=[".smi", ".tsv"],
|
134 |
+
label="Multiple SMILES",
|
135 |
),
|
136 |
gr.File(
|
137 |
file_types=[".csv"],
|
model_cards/article.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
-
|
2 |
|
3 |
|
4 |
-
**SMILES**:
|
5 |
|
|
|
6 |
|
7 |
-
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
## Citation
|
|
|
1 |
+
## Model documentation
|
2 |
|
3 |
|
4 |
+
**SMILES**: A single SMILES representing a drug for which the prediction should be performed.
|
5 |
|
6 |
+
**Multiple SMILES**: Alternatively, you can upload a `.smi` or a `.tsv` file that is tab-separated and contains SMILES in the first column. Note that it **must not** contain a header. Moreover, provide *either* a single SMILES *or* a file, not both!
|
7 |
|
8 |
+
**Transcriptomics data file**: Here, you can optionally upload an omics file with cell lines in rows and genes in columns. If not provided, predictions will be performed on the cell lines available in the [GDSC](https://academic.oup.com/nar/article/41/D1/D955/1059448) and [CCLE](https://sites.broadinstitute.org/ccle/) databases.
|
9 |
|
10 |
+
**Confidence**: This toggle determines whether the model returns confidence estimates. If toggled on, this will take ~15 times more time to run. The model will return two estimates, for aleatoric and epistemic uncertainty respectively.
|
11 |
+
|
12 |
+
## NOTE
|
13 |
+
If you are an user of the old, deprecated PaccMann webservice (that was hosted on IBM Cloud) and you miss certain functionalities such as analysing the SMILES or the gene attention, please reach out to {jab,tte}@zurich.ibm.com and we will try to provide those features timely.
|
14 |
|
15 |
|
16 |
## Citation
|