{"id":21441722,"url":"https://github.com/dmis-lab/tpp_mol_dpo","last_synced_at":"2026-02-18T16:31:22.830Z","repository":{"id":260584936,"uuid":"881673398","full_name":"dmis-lab/TPP_MOL_DPO","owner":"dmis-lab","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-12T06:26:08.000Z","size":393,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T06:34:12.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmis-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-01T02:19:26.000Z","updated_at":"2025-01-12T06:26:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"83b17748-4301-43ec-a0a3-95ef6ce98db4","html_url":"https://github.com/dmis-lab/TPP_MOL_DPO","commit_stats":null,"previous_names":["dmis-lab/tpp_mol_dpo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmis-lab%2FTPP_MOL_DPO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmis-lab%2FTPP_MOL_DPO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmis-lab%2FTPP_MOL_DPO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmis-lab%2FTPP_MOL_DPO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmis-lab","download_url":"https://codeload.github.com/dmis-lab/TPP_MOL_DPO/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249778575,"owners_count":21324283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T01:41:16.244Z","updated_at":"2026-02-18T16:31:22.819Z","avatar_url":"https://github.com/dmis-lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Target Product Profile-Guided Drug Design Using Multi-objective Direct Preference Optimization\n\nSejeong Park\\*, Jungwoo Park\\*, Donghyeon Lee, Sunkyu Kim, Jaewoo Kang (\\* indicates equal contribution)\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./figures/figure-1.png\" alt=\"./figures/figure-1.png\" width=\"90%\"/\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\nAbstarct: *Fragment-Based Drug Design (FBDD) offers unique advantages in exploring chemical space and optimizing lead compounds. However, existing FBDD approaches often struggle to efficiently meet complex Target Product Profile (TPP) requirements due to the significant time and financial investments typically required in traditional workflows. This study introduces a novel TPP-guided fragment-based generative model that integrates Direct Preference Optimization (DPO) with sequence-based fragment generation. The model transforms multiobjective optimization into a preference learning task, simultaneously optimizing multiple molecular properties from the earliest design stages. Key innovations include In-Batch DPO for computational efficiency and a multi-objective learning strategy balancing diverse molecular properties. Case studies across various therapeutic targets demonstrate significant improvements in generating diverse drug candidates optimized for binding affinity, synthetic accessibility, druglikeness and ADMET properties, potentially accelerating the discovery of novel therapeutics for challenging targets.*\n\nThis repository contains the code to reproduce the experiments in the paper.\n\n## Prerequisite\n\nOur framework supports both GPU and TPU via [Jax](https://github.com/jax-ml/jax) and [Flax](https://github.com/google/flax). If you plan to train models on GPUs, you can skip this section. For TPU training, we recommend using [TPU-v3-8](https://cloud.google.com/tpu/docs/v3). Researchers can apply for free TPU credits through [the TPU Research Cloud (TRC) program](https://sites.research.google/trc/about/). To apply, visit the TRC program page here.\n\nTo create a TPU VM instance, use the following command:\n\n```bash\n$ gcloud compute tpus tpu-vm create tpu-name \\\n    --zone=europe-west4-a \\\n    --accelerator-type=v3-8 \\\n    --version=tpu-vm-base\n```\nNow you can access the TPU VM through SSH:\n```bash\ngcloud compute tpus tpu-vm ssh tpu-name --zone=europe-west4-a\n```\n\n## Requirements\n\nTo set up the environment, first install Conda. If Conda is already installed, you can skip to the corresponding environment section. Use the following command to install Miniconda:\n\n```bash\n$ wget https://repo.anaconda.com/miniconda/Miniconda3-py310_24.1.2-0-Linux-x86_64.sh\n$ bash Miniconda3-py310_24.1.2-0-Linux-x86_64.sh -b -u\n```\n\n### GPU Environment\nInstall the required packages using pip:\n```bash\npip install -U \"jax[cuda12]\"\npip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu\npip install -U flax optax chex webdataset wandb fsspec gcsfs transformers sentencepiece tiktoken omegaconf safe-mol pandas==2.0.0 numpy==1.26.4 admet-ai typing_extensions\n```\n\n### TPU Environment\nInstall the required packages using pip:\n```bash\n$ pip install -U \"jax[tpu]\" -f https://storage.googleapis.com/jax-releases/libtpu_releases.html\n$ pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu\n$ pip install -U flax optax chex webdataset wandb fsspec gcsfs transformers sentencepiece tiktoken omegaconf safe-mol pandas==2.0.0 admet-ai\n```\n\n## Getting Started\n\n### Prepare a Preference Dataset\n\nTo support various molecule generation methods, such as de novo and scaffold decoration, we use the [SAFE-GPT](https://huggingface.co/datamol-io/safe-gpt) model with [SAFE](https://arxiv.org/abs/2310.10773) representation.\nTo apply preference optimization to the model, we first generate molecules and then evaluate their molecular properties.\nUnlike conventional preference optimization methods, we only need the molecular properties instead of direct comparison or other preference signals.\n\nWe found that de novo generated molecules suffice to optimize the model's entire chemical space, thereby also improving molecules for scaffold decoration and scaffold morphing.\nYou can follow [this tutorial](https://safe-docs.datamol.io/stable/tutorials/design-with-safe.html#de-novo-generation) to generate molecules yourself or use the command below:\n```bash\n$ python scripts/generate_de_novo_samples.py \\\n    --num-samples 100000 \\\n    --batch-size 256 \\\n    --max-length 128 \\\n    --output safe-de-novo-dataset.csv\n```\nThis script automatically evaluates the necessary properties, including SA score, QED, and ADMET scores from [ADMET-AI](https://github.com/swansonk14/admet_ai). We recommend running this script on a GPU environment for faster generation.\n\nIf you want to optimize the docking score as well, run [AutoDock-GPU](https://github.com/ccsb-scripps/AutoDock-GPU) to calculate the binding affinity of each molecule and then combine it with the training dataset.\nRefer to [scripts/convert_smiles_to_pdbqt.py](scripts/convert_smiles_to_pdbqt.py) for SMILES-to-PDBQT conversion, and then run AutoDock with your target protein.\nAfter running the AutoDock program, you can find the `.dlg` output file containing:\n```\nAutoDock-GPU version: v1.5.3-73-gf5cf6ffdd0c5b3f113d5cc424fabee51df04da7e\n\n**********************************************************\n**    AutoDock-GPU AUTODOCKTOOLS-COMPATIBLE DLG FILE    **\n**********************************************************\n\n[...]\n\n    RMSD TABLE\n    __________\n\n\n_______________________________________________________________________\n     |      |      |           |         |                 |\nRank | Sub- | Run  | Binding   | Cluster | Reference       | Grep\n     | Rank |      | Energy    | RMSD    | RMSD            | Pattern\n_____|______|______|___________|_________|_________________|___________\n   1      1     19       -6.63      0.00     13.74           RANKING\n   1      2      6       -6.63      0.11     13.79           RANKING\n   1      3     12       -6.62      0.09     13.76           RANKING\n   1      4     14       -6.61      0.23     13.79           RANKING\n   1      5     10       -6.60      0.19     13.78           RANKING\n   1      6      5       -6.44      0.57     13.69           RANKING\n   1      7      2       -6.44      0.60     13.73           RANKING\n   1      8     11       -6.43      0.58     13.75           RANKING\n   1      9     20       -6.42      0.56     13.78           RANKING\n   1     10     15       -6.36      0.58     13.72           RANKING\n   1     11     13       -6.22      0.62     13.82           RANKING\n   1     12     18       -5.85      0.79     13.57           RANKING\n   2      1      9       -6.18      0.00     11.90           RANKING\n   2      2     16       -5.90      0.93     11.71           RANKING\n   2      3      8       -5.90      0.94     11.72           RANKING\n   2      4     17       -5.85      0.97     11.67           RANKING\n   3      1      4       -5.73      0.00     11.13           RANKING\n   3      2      1       -5.60      1.52     11.86           RANKING\n   3      3      3       -5.54      1.54     11.67           RANKING\n   4      1      7       -5.53      0.00     11.92           RANKING\n\nRun time 0.225 sec\nIdle time 0.161 sec\n```\nChoose the highest-ranked binding energy as a docking score and merge it into the training dataset with a column name, e.g., `DS_7O2I`.\n\n### Optimize Molecular Properties\nNow we can optimize the SAFE-GPT model with our preference dataset.\nThere are three configuration presets:\n- [config/safe-dpo-simple-20ep.sh](config/safe-dpo-simple-20ep.sh): Simple averaging for multi-objective preference optimization.\n- [config/safe-dpo-moco-20ep.sh](config/safe-dpo-moco-20ep.sh): Balanced multi-objective preference optimization.\n- [config/safe-dpo-moco-20ep-pref.sh](config/safe-dpo-moco-20ep-pref.sh): Balanced multi-objective preference optimization with user preferences.\n\nUsing these presets, you can run an experiment with various senarios and property combinations:\n```bash\n### Simple Averaging ###\nbash config/safe-dpo-simple-20ep.sh safe-dpo-simple-20ep-8P1Q_SAScore_QED               ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1\"\nbash config/safe-dpo-simple-20ep.sh safe-dpo-simple-20ep-8P1Q_hERG_CYPs                 ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-simple-20ep.sh safe-dpo-simple-20ep-8P1Q_SAScore_QED_CYPs          ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0\"\nbash config/safe-dpo-simple-20ep.sh safe-dpo-simple-20ep-8P1Q_SAScore_QED_hERG          ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-simple-20ep.sh safe-dpo-simple-20ep-8P1Q_SAScore_QED_hERG_CYPs     ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\n\n### Balanced ###\nbash config/safe-dpo-moco-20ep.sh safe-dpo-moco-nopref-20ep-8P1Q_SAScore_QED            ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1\"\nbash config/safe-dpo-moco-20ep.sh safe-dpo-moco-nopref-20ep-8P1Q_hERG_CYPs              ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-moco-20ep.sh safe-dpo-moco-nopref-20ep-8P1Q_SAScore_QED_CYPs       ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0\"\nbash config/safe-dpo-moco-20ep.sh safe-dpo-moco-nopref-20ep-8P1Q_SAScore_QED_hERG       ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-moco-20ep.sh safe-dpo-moco-nopref-20ep-8P1Q_SAScore_QED_hERG_CYPs  ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\n\n### Balanced w/ Preferences ###\nbash config/safe-dpo-moco-20ep-pref.sh safe-dpo-moco-20ep-8P1Q_SAScore_QED              ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1\"\nbash config/safe-dpo-moco-20ep-pref.sh safe-dpo-moco-20ep-8P1Q_hERG_CYPs                ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-moco-20ep-pref.sh safe-dpo-moco-20ep-8P1Q_SAScore_QED_CYPs         ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0\"\nbash config/safe-dpo-moco-20ep-pref.sh safe-dpo-moco-20ep-8P1Q_SAScore_QED_hERG         ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\nbash config/safe-dpo-moco-20ep-pref.sh safe-dpo-moco-20ep-8P1Q_SAScore_QED_hERG_CYPs    ./safe-dpo-full-dataset-94k.csv     \"DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0 CYP1A2_Veith:min:0 CYP2C9_Veith:min:0 CYP2C19_Veith:min:0 CYP2D6_Veith:min:0 CYP3A4_Veith:min:0\"\n```\nEach script requires three arguments.\n- The first argument is the experiment name.\n- The second argument is the path to the training dataset constructed in the section above.\n- The third argument specifies the target molecular properties in the format: `[column]:[min/max]:[pref]`.\n\nFor instance, `DS_8P1Q:min:5 SAScore:min:1 QED:max:1 hERG:min:0` minimizes the docking score of protein 8P1Q, the SA score, and the hERG channel blocking, while maximizing the QED drug-likeness score.\nWith the preset [config/safe-dpo-moco-20ep-pref.sh](config/safe-dpo-moco-20ep-pref.sh), the balanced loss weights will focus more on the docking score since its preference strength is 5.\n\n## Citation\n```bibtex\n@misc{park2024tppmoldpo,\n      title={Target Product Profile-Guided Drug Design Using Multi-objective Direct Preference Optimization},\n      author={Sejeong Park, Jungwoo Park, Donghyeon Lee, Sunkyu Kim, Jaewoo Kang},\n      year={2024},\n}\n``` \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmis-lab%2Ftpp_mol_dpo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmis-lab%2Ftpp_mol_dpo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmis-lab%2Ftpp_mol_dpo/lists"}