A hybrid approach combining fragment generation and screening for structure-based fragment growing/elaboration.
- Clone the repository:
git clone https://github.com/Kartinaa/Slogen.git
cd Slogen- Install dependencies:
conda env create -f environment.yamlYou could download data files from HuggingFace and pretrained model checkpoint from Zenodo. Then put them in corresponding folders as follows:
Slogen/
├── data/ # Datasets and examples
│ ├── example/
│ ├── small_frag/
| | ├── high/
| | ├── high_name2id.pt
| | ├── high_processed.lmdb
├── ckpt/ # Model checkpoints
│ ├── train_1000_2025_06_29__20_16_35/
| | ├── 2340000.pt
Data pre-processing:
We provided two script for pre-processing the PL complex to the format needed by Slogen.
For protein input, residues around 6A of ligand will be extracted by preprocessing/extract_protein_near_ligand.py.
For ligand input, you could using SMILES with connecting point indicated by dummy atom to generate 3D parent fragment by preprocessing/extract_fragment_with_dummy.py
Example command will be:
For protein input:
python preprocessing/extract_protein_near_ligand.py --protein data/example/protein.pdb --ligand data/example/ligand.sdf --output data/example/protein_6A.pdbFor ligand input:
python preprcessing/extract_fragment_with_dummy.py --ligand_sdf data/example/ligand.sdf --smiles 'OC1=CC=C(OC[C@H](O)C[NH2+][*])C=C1' --out_sdf data/example/big.sdf --match_index 0The big.sdf should be same with data/example/target_CHEMBL210_CHEMBL12994_2_big.sdf.
Train the GNN predictor on protein-ligand complexes:
python train.py --config ./configs/train.yml --device cudaConfiguration (configs/train.yml):
-
Model architecture parameters
-
Training hyperparameters
-
Dataset paths and splits
Generate latent vectors for molecular fragments:
python sample_latent.py \
--pocket_path data/example/protein_6A.pdb \
--ligand_path data/example/target_CHEMBL210_CHEMBL12994_1_big.sdf \
--checkpoint ckpt/train_1000_2025_06_29__20_16_35/2340000.ptConvert latent vectors to molecular SMILES:
python decode_smiles.py \
--latent_mu sample_latent_outputs/*Your_latent_folder*/sampled_latent_mu.npy \
--latent_var sample_latent_outputs/*Your_latent_folder*/sampled_latent_var.npy \
--num_smiles 50 \
--temperature 1.0Run the complete generation pipeline:
python sample_and_decode.py \
--pocket_path pl_complex_separate_6A.pdb \
--ligand_path pl_complex_separate_big.sdf \
--checkpoint ckpt/train_1000_2025_06_29__20_16_35/2340000.pt \
--num_smiles 50-
pocket_path: PDB format files containing residues around 6Å of the ligand of interest.
-
Ligand: SDF format files containing parent fragments with connecting point marked by dummy atom
Your_defined_output_folder/
├── Unique_name_for_each_run/
│ ├── 2340000.pt # Checkpoint used for this run.
│ ├── generated_*_unique_neutralized_2340000.smi # Generated fragments, connecting point marked by dummy atom '*'.
│ ├── *.pdb # input pocket file.
│ ├── *.sdf # input parent fragment file.
│ ├── sample_and_decode.log # log file
│ ├── sample_latent.yml # Config file used for generation.
│ ├── sampled_latent_mu.npy # predicted mu vector.
│ ├── sampled_latent_var.npy # predicted var vector.