Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -112,19 +112,25 @@ def function(model_name: str, num_molecules: int, seed_num: int):
|
|
112 |
"SA Score": [scores["sa"].iloc[0]]
|
113 |
})
|
114 |
|
115 |
-
#
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
output_file_path = f'experiments/inference/{model_name}/inference_drugs.txt'
|
130 |
|
@@ -160,7 +166,7 @@ def function(model_name: str, num_molecules: int, seed_num: int):
|
|
160 |
highlightBondLists=None,
|
161 |
)
|
162 |
|
163 |
-
return molecule_image, score_df, new_path,
|
164 |
|
165 |
|
166 |
|
@@ -200,6 +206,8 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
200 |
|
201 |
with gr.Accordion("About DrugGEN Models", open=False):
|
202 |
gr.Markdown("""
|
|
|
|
|
203 |
### DrugGEN-AKT1
|
204 |
This model is designed to generate molecules targeting the human AKT1 protein (UniProt ID: P31749).
|
205 |
|
@@ -227,7 +235,7 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
|
227 |
### Novelty Metrics
|
228 |
- **Novelty (Train)**: Percentage of molecules not found in the training set
|
229 |
- **Novelty (Test)**: Percentage of molecules not found in the test set
|
230 |
-
- **Drug Novelty**: Percentage of molecules not found in known
|
231 |
|
232 |
### Structural Metrics
|
233 |
- **Max Length**: Maximum component length in the generated molecules
|
@@ -272,6 +280,19 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
|
272 |
)
|
273 |
|
274 |
with gr.Column(scale=2):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
image_output = gr.Image(
|
276 |
label="Sample of Generated Molecules",
|
277 |
elem_id="molecule_display"
|
@@ -300,14 +321,7 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
|
300 |
snn_chembl = gr.Number(label="SNN ChEMBL", precision=3)
|
301 |
snn_drug = gr.Number(label="SNN Drug", precision=3)
|
302 |
max_len = gr.Number(label="Max Length", precision=3)
|
303 |
-
|
304 |
-
with gr.Accordion("All Metrics (Table View)", open=False):
|
305 |
-
scores_df = gr.Dataframe(
|
306 |
-
headers=["Runtime (seconds)", "Validity", "Uniqueness", "Novelty (Train)", "Novelty (Test)",
|
307 |
-
"Drug Novelty", "Max Length", "Mean Atom Type", "SNN ChEMBL", "SNN Drug",
|
308 |
-
"Internal Diversity", "QED", "SA Score"]
|
309 |
-
)
|
310 |
-
|
311 |
gr.Markdown("### Created by the HUBioDataLab | [GitHub](https://github.com/HUBioDataLab/DrugGEN) | [Paper](https://arxiv.org/abs/2302.07868)")
|
312 |
|
313 |
submit_button.click(
|
@@ -332,5 +346,7 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
|
332 |
],
|
333 |
api_name="inference"
|
334 |
)
|
|
|
335 |
demo.queue()
|
336 |
-
demo.launch()
|
|
|
|
112 |
"SA Score": [scores["sa"].iloc[0]]
|
113 |
})
|
114 |
|
115 |
+
# Create basic metrics dataframe
|
116 |
+
basic_metrics = pd.DataFrame({
|
117 |
+
"Validity": [scores["validity"].iloc[0]],
|
118 |
+
"Uniqueness": [scores["uniqueness"].iloc[0]],
|
119 |
+
"Novelty (Train)": [scores["novelty"].iloc[0]],
|
120 |
+
"Novelty (Test)": [scores["novelty_test"].iloc[0]],
|
121 |
+
"Drug Novelty": [scores["drug_novelty"].iloc[0]],
|
122 |
+
"Runtime (s)": [round(et, 2)]
|
123 |
+
})
|
124 |
+
|
125 |
+
# Create advanced metrics dataframe
|
126 |
+
advanced_metrics = pd.DataFrame({
|
127 |
+
"QED": [scores["qed"].iloc[0]],
|
128 |
+
"SA Score": [scores["sa"].iloc[0]],
|
129 |
+
"Internal Diversity": [scores["IntDiv"].iloc[0]],
|
130 |
+
"SNN ChEMBL": [scores["snn_chembl"].iloc[0]],
|
131 |
+
"SNN Drug": [scores["snn_drug"].iloc[0]],
|
132 |
+
"Max Length": [scores["max_len"].iloc[0]]
|
133 |
+
})
|
134 |
|
135 |
output_file_path = f'experiments/inference/{model_name}/inference_drugs.txt'
|
136 |
|
|
|
166 |
highlightBondLists=None,
|
167 |
)
|
168 |
|
169 |
+
return molecule_image, score_df, new_path, basic_metrics, advanced_metrics
|
170 |
|
171 |
|
172 |
|
|
|
206 |
|
207 |
with gr.Accordion("About DrugGEN Models", open=False):
|
208 |
gr.Markdown("""
|
209 |
+
## Model Variations
|
210 |
+
|
211 |
### DrugGEN-AKT1
|
212 |
This model is designed to generate molecules targeting the human AKT1 protein (UniProt ID: P31749).
|
213 |
|
|
|
235 |
### Novelty Metrics
|
236 |
- **Novelty (Train)**: Percentage of molecules not found in the training set
|
237 |
- **Novelty (Test)**: Percentage of molecules not found in the test set
|
238 |
+
- **Drug Novelty**: Percentage of molecules not found in known inhibitors of the target protein
|
239 |
|
240 |
### Structural Metrics
|
241 |
- **Max Length**: Maximum component length in the generated molecules
|
|
|
280 |
)
|
281 |
|
282 |
with gr.Column(scale=2):
|
283 |
+
with gr.Row():
|
284 |
+
with gr.Column():
|
285 |
+
basic_metrics_df = gr.Dataframe(
|
286 |
+
headers=["Validity", "Uniqueness", "Novelty (Train)", "Novelty (Test)", "Drug Novelty", "Runtime (s)"],
|
287 |
+
elem_id="basic-metrics"
|
288 |
+
)
|
289 |
+
|
290 |
+
with gr.Column():
|
291 |
+
advanced_metrics_df = gr.Dataframe(
|
292 |
+
headers=["QED", "SA Score", "Internal Diversity", "SNN ChEMBL", "SNN Drug", "Max Length"],
|
293 |
+
elem_id="advanced-metrics"
|
294 |
+
)
|
295 |
+
|
296 |
image_output = gr.Image(
|
297 |
label="Sample of Generated Molecules",
|
298 |
elem_id="molecule_display"
|
|
|
321 |
snn_chembl = gr.Number(label="SNN ChEMBL", precision=3)
|
322 |
snn_drug = gr.Number(label="SNN Drug", precision=3)
|
323 |
max_len = gr.Number(label="Max Length", precision=3)
|
324 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
gr.Markdown("### Created by the HUBioDataLab | [GitHub](https://github.com/HUBioDataLab/DrugGEN) | [Paper](https://arxiv.org/abs/2302.07868)")
|
326 |
|
327 |
submit_button.click(
|
|
|
346 |
],
|
347 |
api_name="inference"
|
348 |
)
|
349 |
+
|
350 |
demo.queue()
|
351 |
+
demo.launch()
|
352 |
+
|