ScafVAE
June 26, 2025 ยท View on GitHub
ScafVAE, a scaffold-aware VAE framework for multi-objective molecular design.
Table of contents
Installation
Required dependences
ScafVAE is implemented in PyTorch. All basic dependencies are listed in requirements.txt
and most of them can be easily installed with pip install.
We provide tested installation commands in install_cmd.txt, for your reference.
ScafVAE
pip install -e .
Model parameters
Please download the parameters from here (or here), and put it in the ScafVAE/params/.
Usage
Generating moleucules with properties of inerest
You can use ScafVAE to generate multi-objective molecules by following the notebook ScafVAE/demo/demo_molecular_design.ipynb.
The notebook contains:
- Collecting molecules with their properties.
- Training surrogate models.
- Generating multi-objective molecules.
If you want to quickly test the molecular generation, you can simply run the following codes here (or run the ScafVAE/demo/demo_molecular_design.py) to generate the dual-target molecules.
from ScafVAE.app.app_utils import *
df_EGFR, df_HER2 = get_demo_properties(max_num=1000, name='binding') # get molecules with their properties
generation_path = './output' # path for saving data
tasks = [
{
# task name
'name': 'EGFR_inhibition',
# input data
'data': df_EGFR,
# task type: classification / regression
'task_type': 'classification',
# ML model for surrogate model
'ML_model': 'RF',
# property is need to be maximized or minimized: max / min
'optimization_type': 'max',
# pseudo weight for this property
'pseudo_weight': 0.5,
},
{
'name': 'HER2_inhibition',
'data': df_HER2,
'task_type': 'classification',
'ML_model': 'RF',
'optimization_type': 'max',
'pseudo_weight': 0.5,
},
]
base_model, surrogate_model = prepare_data_and_train(generation_path, tasks)
df_output = generate_mol(
10, # number of generated molecules
generation_path, tasks, base_model, surrogate_model,
)
print(df_output) # a dataframe contrains generated molecules with their properties
Train your own model
We provide a pipeline for training the ScafVAE based on user's data in ScafVAE/demo/demo_molecular_pretraining.ipynb.
License
Released under the MIT license.
Citation
@Article{D4SC08736D,
author ="Dong, Tiejun and You, Linlin and Chen, Calvin Yu-Chian",
title ="Multi-objective drug design with a scaffold-aware variational autoencoder",
journal ="Chem. Sci.",
year ="2025",
pages ="-",
publisher ="The Royal Society of Chemistry",
doi ="10.1039/D4SC08736D",}