Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -171,110 +171,110 @@ def run_inference(mode: str, model_name: str, num_molecules: int, seed_num: str,
|
|
171 |
|
172 |
|
173 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
gr.Markdown("# DrugGEN: Target Centric De Novo Design of Drug Candidate Molecules with Graph Generative Deep Adversarial Networks")
|
189 |
|
190 |
-
|
191 |
-
<div style="display: flex; gap: 10px; margin-bottom: 15px;">
|
192 |
-
<!-- arXiv badge -->
|
193 |
-
<a href="https://arxiv.org/abs/2302.07868" target="_blank" style="text-decoration: none;">
|
194 |
-
<div style="
|
195 |
-
display: inline-block;
|
196 |
-
background-color: #b31b1b;
|
197 |
-
color: #ffffff !important;
|
198 |
-
padding: 5px 10px;
|
199 |
-
border-radius: 5px;
|
200 |
-
font-size: 14px;">
|
201 |
-
<span style="font-weight: bold;">arXiv</span> 2302.07868
|
202 |
-
</div>
|
203 |
-
</a>
|
204 |
|
205 |
-
|
206 |
-
<
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
235 |
""")
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
##
|
240 |
-
|
241 |
-
###
|
242 |
-
|
243 |
-
|
244 |
-
-
|
245 |
-
|
246 |
-
|
247 |
-
-
|
248 |
-
-
|
249 |
-
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
- **
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
model_name = gr.Radio(
|
267 |
choices=("DrugGEN-AKT1", "DrugGEN-CDK2", "DrugGEN-NoTarget"),
|
268 |
value="DrugGEN-AKT1",
|
269 |
label="Select Target Model",
|
270 |
info="Choose which protein target or general model to use for molecule generation"
|
271 |
)
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
with gr.Column(scale=1):
|
278 |
num_molecules = gr.Slider(
|
279 |
minimum=10,
|
280 |
maximum=200,
|
@@ -283,33 +283,32 @@ For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
|
283 |
label="Number of Molecules to Generate",
|
284 |
info="This space runs on a CPU, which may result in slower performance. Generating 100 molecules takes approximately 6 minutes. Therefore, we set a 200-molecule cap."
|
285 |
)
|
286 |
-
|
287 |
seed_num = gr.Textbox(
|
288 |
label="Random Seed (Optional)",
|
289 |
value="",
|
290 |
info="Set a specific seed for reproducible results, or leave empty for random generation"
|
291 |
)
|
292 |
-
|
293 |
classical_submit = gr.Button(
|
294 |
value="Generate Molecules",
|
295 |
variant="primary",
|
296 |
size="lg"
|
297 |
)
|
298 |
-
|
299 |
with gr.TabItem("Custom Input SMILES"):
|
300 |
with gr.Row():
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
)
|
313 |
|
314 |
with gr.Column(scale=2):
|
315 |
basic_metrics_df = gr.Dataframe(
|
|
|
171 |
|
172 |
|
173 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
174 |
+
with gr.Column():
|
175 |
+
# Add custom CSS for styling
|
176 |
+
gr.HTML("""
|
177 |
+
<style>
|
178 |
+
#metrics-container {
|
179 |
+
border: 1px solid rgba(128, 128, 128, 0.3);
|
180 |
+
border-radius: 8px;
|
181 |
+
padding: 15px;
|
182 |
+
margin-top: 15px;
|
183 |
+
margin-bottom: 15px;
|
184 |
+
background-color: rgba(255, 255, 255, 0.05);
|
185 |
+
}
|
186 |
+
</style>
|
187 |
+
""")
|
|
|
188 |
|
189 |
+
gr.Markdown("# DrugGEN: Target Centric De Novo Design of Drug Candidate Molecules with Graph Generative Deep Adversarial Networks")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
gr.HTML("""
|
192 |
+
<div style="display: flex; gap: 10px; margin-bottom: 15px;">
|
193 |
+
<!-- arXiv badge -->
|
194 |
+
<a href="https://arxiv.org/abs/2302.07868" target="_blank" style="text-decoration: none;">
|
195 |
+
<div style="
|
196 |
+
display: inline-block;
|
197 |
+
background-color: #b31b1b;
|
198 |
+
color: #ffffff !important;
|
199 |
+
padding: 5px 10px;
|
200 |
+
border-radius: 5px;
|
201 |
+
font-size: 14px;">
|
202 |
+
<span style="font-weight: bold;">arXiv</span> 2302.07868
|
203 |
+
</div>
|
204 |
+
</a>
|
205 |
+
|
206 |
+
<!-- GitHub badge -->
|
207 |
+
<a href="https://github.com/HUBioDataLab/DrugGEN" target="_blank" style="text-decoration: none;">
|
208 |
+
<div style="
|
209 |
+
display: inline-block;
|
210 |
+
background-color: #24292e;
|
211 |
+
color: #ffffff !important;
|
212 |
+
padding: 5px 10px;
|
213 |
+
border-radius: 5px;
|
214 |
+
font-size: 14px;">
|
215 |
+
<span style="font-weight: bold;">GitHub</span> Repository
|
216 |
+
</div>
|
217 |
+
</a>
|
218 |
+
</div>
|
|
|
|
|
219 |
""")
|
220 |
|
221 |
+
with gr.Accordion("About DrugGEN Models", open=False):
|
222 |
+
gr.Markdown("""
|
223 |
+
## Model Variations
|
224 |
+
|
225 |
+
### DrugGEN-AKT1
|
226 |
+
This model is designed to generate molecules targeting the human AKT1 protein (UniProt ID: P31749).
|
227 |
+
|
228 |
+
### DrugGEN-CDK2
|
229 |
+
This model is designed to generate molecules targeting the human CDK2 protein (UniProt ID: P24941).
|
230 |
+
|
231 |
+
### DrugGEN-NoTarget
|
232 |
+
This is a general-purpose model that generates diverse drug-like molecules without targeting a specific protein.
|
233 |
+
- Useful for exploring chemical space, generating diverse scaffolds, and creating molecules with drug-like properties.
|
234 |
+
|
235 |
+
For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
236 |
+
""")
|
237 |
+
|
238 |
+
with gr.Accordion("Understanding the Metrics", open=False):
|
239 |
+
gr.Markdown("""
|
240 |
+
## Evaluation Metrics
|
241 |
+
|
242 |
+
### Basic Metrics
|
243 |
+
- **Validity**: Percentage of generated molecules that are chemically valid
|
244 |
+
- **Uniqueness**: Percentage of unique molecules among valid ones
|
245 |
+
- **Runtime**: Time taken to generate or evaluate the molecules
|
246 |
+
|
247 |
+
### Novelty Metrics
|
248 |
+
- **Novelty (Train)**: Percentage of molecules not found in the training set
|
249 |
+
- **Novelty (Inference)**: Percentage of molecules not found in the test set
|
250 |
+
- **Novelty (Real Inhibitors)**: Percentage of molecules not found in known inhibitors of the target protein
|
251 |
+
|
252 |
+
### Structural Metrics
|
253 |
+
- **Average Length**: Average component length in the generated molecules
|
254 |
+
- **Mean Atom Type**: Average distribution of atom types
|
255 |
+
- **Internal Diversity**: Diversity within the generated set (higher is more diverse)
|
256 |
+
|
257 |
+
### Drug-likeness Metrics
|
258 |
+
- **QED (Quantitative Estimate of Drug-likeness)**: Score from 0-1 measuring how drug-like a molecule is (higher is better)
|
259 |
+
- **SA Score (Synthetic Accessibility)**: Score from 1-10 indicating ease of synthesis (lower is better)
|
260 |
+
|
261 |
+
### Similarity Metrics
|
262 |
+
- **SNN ChEMBL**: Similarity to ChEMBL molecules (higher means more similar to known drug-like compounds)
|
263 |
+
- **SNN Real Inhibitors**: Similarity to known drugs (higher means more similar to approved drugs)
|
264 |
+
""")
|
265 |
+
|
266 |
+
with gr.Row():
|
267 |
model_name = gr.Radio(
|
268 |
choices=("DrugGEN-AKT1", "DrugGEN-CDK2", "DrugGEN-NoTarget"),
|
269 |
value="DrugGEN-AKT1",
|
270 |
label="Select Target Model",
|
271 |
info="Choose which protein target or general model to use for molecule generation"
|
272 |
)
|
273 |
+
|
274 |
+
# Use Gradio Tabs to separate the two modes.
|
275 |
+
with gr.Tabs():
|
276 |
+
with gr.TabItem("Classical Generation"):
|
277 |
+
with gr.Row():
|
|
|
278 |
num_molecules = gr.Slider(
|
279 |
minimum=10,
|
280 |
maximum=200,
|
|
|
283 |
label="Number of Molecules to Generate",
|
284 |
info="This space runs on a CPU, which may result in slower performance. Generating 100 molecules takes approximately 6 minutes. Therefore, we set a 200-molecule cap."
|
285 |
)
|
286 |
+
|
287 |
seed_num = gr.Textbox(
|
288 |
label="Random Seed (Optional)",
|
289 |
value="",
|
290 |
info="Set a specific seed for reproducible results, or leave empty for random generation"
|
291 |
)
|
292 |
+
|
293 |
classical_submit = gr.Button(
|
294 |
value="Generate Molecules",
|
295 |
variant="primary",
|
296 |
size="lg"
|
297 |
)
|
298 |
+
|
299 |
with gr.TabItem("Custom Input SMILES"):
|
300 |
with gr.Row():
|
301 |
+
custom_smiles = gr.Textbox(
|
302 |
+
label="Input SMILES (one per line, maximum 100 molecules)",
|
303 |
+
placeholder="C(C(=O)O)N\nCCO\n...",
|
304 |
+
lines=10
|
305 |
+
)
|
306 |
+
|
307 |
+
custom_submit = gr.Button(
|
308 |
+
value="Generate Molecules using Custom SMILES",
|
309 |
+
variant="primary",
|
310 |
+
size="lg"
|
311 |
+
)
|
|
|
312 |
|
313 |
with gr.Column(scale=2):
|
314 |
basic_metrics_df = gr.Dataframe(
|