{"id":13958578,"url":"https://github.com/pengxingang/pocket2mol","last_synced_at":"2025-07-21T00:31:17.423Z","repository":{"id":37392006,"uuid":"492431831","full_name":"pengxingang/Pocket2Mol","owner":"pengxingang","description":"Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets","archived":false,"fork":false,"pushed_at":"2023-11-16T01:26:24.000Z","size":4790,"stargazers_count":271,"open_issues_count":19,"forks_count":73,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-28T02:34:49.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengxingang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-05-15T08:40:08.000Z","updated_at":"2024-11-27T17:33:54.000Z","dependencies_parsed_at":"2023-02-02T04:01:48.295Z","dependency_job_id":"a259a99d-e827-4864-907f-2f5b931fe6ba","html_url":"https://github.com/pengxingang/Pocket2Mol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pengxingang/Pocket2Mol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengxingang%2FPocket2Mol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengxingang%2FPocket2Mol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengxingang%2FPocket2Mol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengxingang%2FPocket2Mol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengxingang","download_url":"https://codeload.github.com/pengxingang/Pocket2Mol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengxingang%2FPocket2Mol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266221259,"owners_count":23894965,"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-08-08T13:01:45.255Z","updated_at":"2025-07-21T00:31:13.095Z","avatar_url":"https://github.com/pengxingang.png","language":"Python","funding_links":[],"categories":["蛋白质结构"],"sub_categories":["网络服务_其他"],"readme":"# Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets\n\n[Pocket2Mol](https://arxiv.org/abs/2205.07249) used equivariant graph neural networks to improve efficiency and molecule quality of [previous structure-based drug design model](https://arxiv.org/abs/2203.10446).\n\n\u003cimg src=\"./assets/model.jpg\" alt=\"model\"  width=\"70%\"/\u003e\n\n\n## Installation\n**Update**: Now the codes are compatible with PyTorch Geometric (PyG) \u003e= 2.0.\n### Dependency\nThe codes have been tested in the following environment:\nPackage  | Version\n--- | ---\nPython | 3.8.12\nPyTorch | 1.10.1\nCUDA | 11.3.1\nPyTorch Geometric | **2.0.0**\nRDKit | 2022.03\nBioPython | 1.79\n\u003c!-- OpenBabel | 3.1.0 --\u003e\n\u003c!-- NOTE: Current implementation relies on PyTorch Geometric (PyG) \u003c 2.0.0. We will fix compatability issues for the latest PyG version in the future. --\u003e\n### Install via conda yaml file (cuda 11.3)\n```bash\nconda env create -f env_cuda113.yml\nconda activate Pocket2Mol\n```\n\n### Install manually\n\n``` bash\nconda create -n Pocket2Mol python=3.8\nconda activate Pocket2Mol\n\n# Install PyTorch (for cuda 11.3)\nconda install pytorch==1.10.1 cudatoolkit=11.3 -c pytorch -c conda-forge\n# Install PyTorch Geometric (\u003e=2.0.0)\nconda install pyg -c pyg\n\n# Install other tools\nconda install -c conda-forge rdkit\nconda install biopython -c conda-forge # used only in sample_for_pdb.py\nconda install pyyaml easydict python-lmdb -c conda-forge\n\n# Install tensorboard only for training\nconda install tensorboard -c conda-forge  \n```\n\n\n## Datasets\n\nPlease refer to [`README.md`](./data/README.md) in the `data` folder.\n\n## Sampling\n\n**NOTE: It is highly recommended to add `taskset -c` to use only one cpu when sampling (e.g. `taskset -c 0 python sample_xxx.py` to use CPU 0), which is much faster. The reason is not clear yet.**\n\n### Sampling for pockets in the testset\n\nTo sample molecules for the i-th pocket in the testset, please first download the trained models following [`README.md`](./ckpt/README.md) in the `ckpt` folder. \nThen, run the following command:\n\n```bash\npython sample.py --data_id {i} --outdir ./outputs  # Replace {i} with the index of the data. i should be between 0 and 99 for the testset.\n```\n\nWe recommend to specify the GPU device number and restrict the cpu cores using command like:\n\n```bash\nCUDA_VISIBLE_DIVICES=0  taskset -c 0 python sample.py --data_id 0 --outdir ./outputs\n```\nWe also provide a bash file `batch_sample.sh` for sampling molecules for the whole test set in parallel. For example, to sample with three workers, run the following commands in three panes.\n```bash\nCUDA_VISIBLE_DEVICES=0 taskset -c 0 bash batch_sample.sh  3 0 0\n\nCUDA_VISIBLE_DEVICES=0 taskset -c 1 bash batch_sample.sh  3 1 0\n\nCUDA_VISIBLE_DEVICES=0 taskset -c 2 bash batch_sample.sh  3 2 0\n```\nThe three parameters of `batch_sample.py` represent the number of workers, the index of current worker and the start index of the datapoint in the test set, respectively.\n\n**NOTE: We find it much faster to use only one CPU for one sampling program (i.e., set `taskset -c` to use one CPU).**\n\n### Sampling for PDB pockets \nTo generate ligands for your own pocket, you need to provide the `PDB` structure file of the protein, the center coordinate of the pocket bounding box, and optionally the side length of the bounding box (default: 23Å). Note that there is a blank before the first value of the `center` parameter. The blank cannot be omitted if the first value is negative (e.g., `--center  \" -1.5,28.0,36.0\"`).\n\nExample:\n\n```bash\npython sample_for_pdb.py \\\n      --pdb_path ./example/4yhj.pdb\n      --center \" 32.0,28.0,36.0\"\n```\n\n\u003cimg src=\"./assets/bounding_box.png\" alt=\"bounding box\" width=\"70%\" /\u003e\n\n\n## Training\n\n```\npython train.py --config ./configs/train.yml --logdir ./logs\n```\nFor training, we recommend to install [`apex` ](https://github.com/NVIDIA/apex) for lower gpu memory usage. If  so, change the value of `train/use_apex` in the `configs/train.yml` file.\n\n## Citation\n```\n@inproceedings{peng2022pocket2mol,\n  title={Pocket2Mol: Efficient Molecular Sampling Based on 3D Protein Pockets},\n  author={Xingang Peng and Shitong Luo and Jiaqi Guan and Qi Xie and Jian Peng and Jianzhu Ma},\n  booktitle={International Conference on Machine Learning},\n  year={2022}\n}\n```\n\n## Contact \nXingang Peng (xingang.peng@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengxingang%2Fpocket2mol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengxingang%2Fpocket2mol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengxingang%2Fpocket2mol/lists"}