mgyigit commited on
Commit
b92a23b
·
verified ·
1 Parent(s): ecaee5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +108 -109
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
- # Add custom CSS for styling
175
- gr.HTML("""
176
- <style>
177
- #metrics-container {
178
- border: 1px solid rgba(128, 128, 128, 0.3);
179
- border-radius: 8px;
180
- padding: 15px;
181
- margin-top: 15px;
182
- margin-bottom: 15px;
183
- background-color: rgba(255, 255, 255, 0.05);
184
- }
185
- </style>
186
- """)
187
-
188
- gr.Markdown("# DrugGEN: Target Centric De Novo Design of Drug Candidate Molecules with Graph Generative Deep Adversarial Networks")
189
 
190
- gr.HTML("""
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
- <!-- GitHub badge -->
206
- <a href="https://github.com/HUBioDataLab/DrugGEN" target="_blank" style="text-decoration: none;">
207
- <div style="
208
- display: inline-block;
209
- background-color: #24292e;
210
- color: #ffffff !important;
211
- padding: 5px 10px;
212
- border-radius: 5px;
213
- font-size: 14px;">
214
- <span style="font-weight: bold;">GitHub</span> Repository
215
- </div>
216
- </a>
217
- </div>
218
- """)
219
-
220
- with gr.Accordion("About DrugGEN Models", open=False):
221
- gr.Markdown("""
222
- ## Model Variations
223
-
224
- ### DrugGEN-AKT1
225
- This model is designed to generate molecules targeting the human AKT1 protein (UniProt ID: P31749).
226
-
227
- ### DrugGEN-CDK2
228
- This model is designed to generate molecules targeting the human CDK2 protein (UniProt ID: P24941).
229
-
230
- ### DrugGEN-NoTarget
231
- This is a general-purpose model that generates diverse drug-like molecules without targeting a specific protein.
232
- - Useful for exploring chemical space, generating diverse scaffolds, and creating molecules with drug-like properties.
233
-
234
- For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
235
  """)
236
 
237
- with gr.Accordion("Understanding the Metrics", open=False):
238
- gr.Markdown("""
239
- ## Evaluation Metrics
240
-
241
- ### Basic Metrics
242
- - **Validity**: Percentage of generated molecules that are chemically valid
243
- - **Uniqueness**: Percentage of unique molecules among valid ones
244
- - **Runtime**: Time taken to generate or evaluate the molecules
245
-
246
- ### Novelty Metrics
247
- - **Novelty (Train)**: Percentage of molecules not found in the training set
248
- - **Novelty (Inference)**: Percentage of molecules not found in the test set
249
- - **Novelty (Real Inhibitors)**: Percentage of molecules not found in known inhibitors of the target protein
250
-
251
- ### Structural Metrics
252
- - **Average Length**: Average component length in the generated molecules
253
- - **Mean Atom Type**: Average distribution of atom types
254
- - **Internal Diversity**: Diversity within the generated set (higher is more diverse)
255
-
256
- ### Drug-likeness Metrics
257
- - **QED (Quantitative Estimate of Drug-likeness)**: Score from 0-1 measuring how drug-like a molecule is (higher is better)
258
- - **SA Score (Synthetic Accessibility)**: Score from 1-10 indicating ease of synthesis (lower is better)
259
-
260
- ### Similarity Metrics
261
- - **SNN ChEMBL**: Similarity to ChEMBL molecules (higher means more similar to known drug-like compounds)
262
- - **SNN Real Inhibitors**: Similarity to known drugs (higher means more similar to approved drugs)
263
- """)
264
- with gr.Row():
265
- with gr.Column(scale=1):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- # Use Gradio Tabs to separate the two modes.
274
- with gr.Tabs():
275
- with gr.TabItem("Classical Generation"):
276
- with gr.Row():
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
- with gr.Column(scale=1):
302
- # Reuse model selection for custom input
303
- custom_smiles = gr.Textbox(
304
- label="Input SMILES (one per line, maximum 100 molecules)",
305
- placeholder="C(C(=O)O)N\nCCO\n...",
306
- lines=10
307
- )
308
- custom_submit = gr.Button(
309
- value="Generate Molecules using Custom SMILES",
310
- variant="primary",
311
- size="lg"
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(