bio-analyze-docking 0.1.0a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bio_analyze_docking-0.1.0a0/.gitignore +26 -0
- bio_analyze_docking-0.1.0a0/CHANGELOG.md +0 -0
- bio_analyze_docking-0.1.0a0/PKG-INFO +239 -0
- bio_analyze_docking-0.1.0a0/README.md +217 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare-ligand.json +39 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare-ligand_cli.json +40 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare-receptor.json +49 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare-receptor_cli.json +50 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare_ligand_api.json +40 -0
- bio_analyze_docking-0.1.0a0/metadata/prepare_receptor_api.json +80 -0
- bio_analyze_docking-0.1.0a0/metadata/run.json +169 -0
- bio_analyze_docking-0.1.0a0/metadata/run_api.json +160 -0
- bio_analyze_docking-0.1.0a0/metadata/run_batch_api.json +170 -0
- bio_analyze_docking-0.1.0a0/metadata/run_cli.json +170 -0
- bio_analyze_docking-0.1.0a0/metadata/run_gnina_api.json +140 -0
- bio_analyze_docking-0.1.0a0/metadata/run_gnina_batch_api.json +150 -0
- bio_analyze_docking-0.1.0a0/metadata/run_gnina_cli.json +160 -0
- bio_analyze_docking-0.1.0a0/metadata/run_haddock_api.json +100 -0
- bio_analyze_docking-0.1.0a0/metadata/run_haddock_batch_api.json +100 -0
- bio_analyze_docking-0.1.0a0/metadata/run_haddock_cli.json +80 -0
- bio_analyze_docking-0.1.0a0/metadata/run_smina_api.json +140 -0
- bio_analyze_docking-0.1.0a0/metadata/run_smina_batch_api.json +150 -0
- bio_analyze_docking-0.1.0a0/metadata/run_smina_cli.json +160 -0
- bio_analyze_docking-0.1.0a0/metadata/run_vina_api.json +140 -0
- bio_analyze_docking-0.1.0a0/metadata/run_vina_batch_api.json +150 -0
- bio_analyze_docking-0.1.0a0/metadata/run_vina_cli.json +160 -0
- bio_analyze_docking-0.1.0a0/pyproject.toml +36 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/__init__.py +8 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/api.py +952 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/cli.py +426 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engine.py +11 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/__init__.py +20 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/base.py +209 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/factory.py +86 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/gnina.py +310 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/haddock.py +223 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/smina.py +299 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/engines/vina.py +178 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/nodes.py +1003 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/prep.py +523 -0
- bio_analyze_docking-0.1.0a0/src/bio_analyze_docking/utils.py +177 -0
- bio_analyze_docking-0.1.0a0/tests/conftest.py +151 -0
- bio_analyze_docking-0.1.0a0/tests/data/ligand/AAAAML.xaa.sdf +724 -0
- bio_analyze_docking-0.1.0a0/tests/data/ligand/AAAAMM.xaa.sdf +4373 -0
- bio_analyze_docking-0.1.0a0/tests/data/ligand/AAAAMN.xaa.sdf +10961 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/gnina_out.pdbqt +32 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_ligands/AAAAML.xaa.pdbqt +27 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_ligands/AAAAMM.xaa.pdbqt +22 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_ligands/AAAAMN.xaa.pdbqt +27 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_1_isoform_x1_scophthalmus_maximus_model_0.pdbqt +7913 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_1_isoform_x1_scophthalmus_maximus_model_0_fixed.pdb +12884 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_7_scophthalmus_maximus_model_0.pdbqt +10477 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_7_scophthalmus_maximus_model_0_fixed.pdb +17094 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_9_scophthalmus_maximus_model_0.pdbqt +11011 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/prepared_receptors/fold_tlr_9_scophthalmus_maximus_model_0_fixed.pdb +17788 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/smina_out.pdbqt +31 -0
- bio_analyze_docking-0.1.0a0/tests/data/mock_results/vina_out.pdbqt +34 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_ligand/AAAAML.xaa.pdbqt +27 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_ligand/AAAAMM.xaa.pdbqt +22 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_ligand/AAAAMN.xaa.pdbqt +27 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_receptor/fold_tlr_1_isoform_x1_scophthalmus_maximus_model_0.pdbqt +7913 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_receptor/fold_tlr_7_scophthalmus_maximus_model_0.pdbqt +10477 -0
- bio_analyze_docking-0.1.0a0/tests/data/prepared_receptor/fold_tlr_9_scophthalmus_maximus_model_0.pdbqt +11011 -0
- bio_analyze_docking-0.1.0a0/tests/data/receptor/fold_tlr_1_isoform_x1_scophthalmus_maximus_model_0.cif +8214 -0
- bio_analyze_docking-0.1.0a0/tests/data/receptor/fold_tlr_7_scophthalmus_maximus_model_0.cif +10831 -0
- bio_analyze_docking-0.1.0a0/tests/data/receptor/fold_tlr_9_scophthalmus_maximus_model_0.cif +11329 -0
- bio_analyze_docking-0.1.0a0/tests/test_auto_box.py +168 -0
- bio_analyze_docking-0.1.0a0/tests/test_cli_config.py +275 -0
- bio_analyze_docking-0.1.0a0/tests/test_complex_output.py +129 -0
- bio_analyze_docking-0.1.0a0/tests/test_docker_engines.py +93 -0
- bio_analyze_docking-0.1.0a0/tests/test_gnina.py +83 -0
- bio_analyze_docking-0.1.0a0/tests/test_haddock.py +67 -0
- bio_analyze_docking-0.1.0a0/tests/test_integration.py +81 -0
- bio_analyze_docking-0.1.0a0/tests/test_nodes_boxes.py +76 -0
- bio_analyze_docking-0.1.0a0/tests/test_prep.py +181 -0
- bio_analyze_docking-0.1.0a0/tests/test_smina.py +90 -0
- bio_analyze_docking-0.1.0a0/tests/test_summary.py +66 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*.pyd
|
|
4
|
+
*.pyo
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
.venv/
|
|
8
|
+
env/
|
|
9
|
+
venv/
|
|
10
|
+
|
|
11
|
+
build/
|
|
12
|
+
dist/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.ruff_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
|
|
21
|
+
uv.lock
|
|
22
|
+
|
|
23
|
+
*.log
|
|
24
|
+
output
|
|
25
|
+
.trae/
|
|
26
|
+
*.xml
|
|
File without changes
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bio-analyze-docking
|
|
3
|
+
Version: 0.1.0a0
|
|
4
|
+
Summary: Molecular docking module for bio-analyze.
|
|
5
|
+
Author: qww
|
|
6
|
+
License: GPL-3.0
|
|
7
|
+
Requires-Python: <3.15,>=3.9
|
|
8
|
+
Requires-Dist: bio-analyze-core>=0.1.0a0
|
|
9
|
+
Requires-Dist: gemmi>=0.6.0
|
|
10
|
+
Requires-Dist: meeko>=0.5.1
|
|
11
|
+
Requires-Dist: numpy>=1.20.0
|
|
12
|
+
Requires-Dist: openbabel-wheel
|
|
13
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
14
|
+
Requires-Dist: pandas>=2.0.0
|
|
15
|
+
Requires-Dist: pdbfixer>=1.9.0
|
|
16
|
+
Requires-Dist: propka>=3.5.0
|
|
17
|
+
Requires-Dist: rdkit>=2024.03.1
|
|
18
|
+
Requires-Dist: scipy>=1.10.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# bio-analyze-docking
|
|
24
|
+
|
|
25
|
+
An automated molecular docking module based on Vina, providing a full-pipeline solution from receptor/ligand preparation to docking simulation and result summarization. Supports both single docking and high-throughput batch docking.
|
|
26
|
+
|
|
27
|
+
## ✨ Features
|
|
28
|
+
|
|
29
|
+
- **Batch Processing**: Supports multi-to-multi (M receptors x N ligands) batch docking by specifying directories, automatically handling task scheduling.
|
|
30
|
+
- **Resumable**: Batch tasks support resuming; if interrupted, restarting will skip already completed tasks.
|
|
31
|
+
- **Wide Format Support**:
|
|
32
|
+
- **Receptor**: Supports `.pdb`, `.cif`, `.mmcif` (automatically converted to PDB).
|
|
33
|
+
- **Ligand**: Supports `.sdf`, `.mol2`, `.pdb`, `.smi` (SMILES).
|
|
34
|
+
- **Result Summarization**: Automatically generates `docking_summary.csv`, containing binding affinities, RMSD, and box parameters.
|
|
35
|
+
- **Complex Generation**: Optionally generates the docked receptor-ligand complex structure (PDB format) for easy viewing in PyMOL.
|
|
36
|
+
- **Automated Preparation**: Integrates `Meeko` and `PDBFixer` to automatically handle receptor protonation, missing atom completion, and ligand PDBQT conversion.
|
|
37
|
+
|
|
38
|
+
## 🔧 Dependencies
|
|
39
|
+
|
|
40
|
+
- **AutoDock Vina** (via Python `vina` package)
|
|
41
|
+
- **Smina** (Advanced fork of Vina, must be installed in PATH)
|
|
42
|
+
- **Gnina** (Deep learning-based docking, must be installed in PATH)
|
|
43
|
+
- **Meeko** (Ligand/Receptor preparation)
|
|
44
|
+
- **RDKit** (Chemical informatics)
|
|
45
|
+
- **OpenBabel** (Backup for receptor preparation)
|
|
46
|
+
- **Gemmi** (CIF/mmCIF support)
|
|
47
|
+
- **PDBFixer** (Receptor repair)
|
|
48
|
+
|
|
49
|
+
## 🚀 Usage
|
|
50
|
+
|
|
51
|
+
### 1. Receptor Preparation
|
|
52
|
+
|
|
53
|
+
Converts PDB/CIF files to PDBQT format, automatically adding polar hydrogens.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Single file
|
|
57
|
+
uv run bioanalyze docking prepare-receptor receptor.pdb -o receptor.pdbqt
|
|
58
|
+
|
|
59
|
+
# CIF format support
|
|
60
|
+
uv run bioanalyze docking prepare-receptor structure.cif -o structure.pdbqt
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Ligand Preparation
|
|
64
|
+
|
|
65
|
+
Converts SDF/SMILES/PDB files to PDBQT format, automatically generating 3D conformations and handling flexible bonds.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv run bioanalyze docking prepare-ligand ligand.sdf -o ligand.pdbqt
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Run Docking
|
|
72
|
+
|
|
73
|
+
#### Scenario A: Single Docking
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv run bioanalyze docking run \
|
|
77
|
+
--receptor receptor.pdbqt \
|
|
78
|
+
--ligand ligand.pdbqt \
|
|
79
|
+
--output ./results \
|
|
80
|
+
--center-x 10.5 --center-y 20.0 --center-z 30.0 \
|
|
81
|
+
--size-x 20 --size-y 20 --size-z 20
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### Scenario B: Batch Docking
|
|
85
|
+
|
|
86
|
+
Simply specify `--receptor` or `--ligand` as directories, and the program will automatically scan for all supported files and perform pairwise docking.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
uv run bioanalyze docking run \
|
|
90
|
+
--receptor ./receptors_dir \
|
|
91
|
+
--ligand ./ligands_dir \
|
|
92
|
+
--output ./batch_results \
|
|
93
|
+
--padding 4.0 # Automatically calculate the box based on the receptor and add 4.0A padding
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Batch Docking Output Structure:**
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
batch_results/
|
|
100
|
+
├── dock_results/
|
|
101
|
+
│ ├── poses/ # Docked poses (PDBQT)
|
|
102
|
+
│ │ └── receptor_name/
|
|
103
|
+
│ │ └── ligand_name_docked.pdbqt
|
|
104
|
+
│ └── complex/ # (Optional) Complex structures (PDB)
|
|
105
|
+
├── docking_summary.csv # Summary table (contains Affinity, RMSD, etc.)
|
|
106
|
+
├── logs/ # Independent logs for each task
|
|
107
|
+
└── configs.json # Run configuration record
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Scenario C: Autoboxing based on Reference Ligand
|
|
111
|
+
|
|
112
|
+
Use a co-crystallized ligand to automatically determine the docking center and extent.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
uv run bioanalyze docking run \
|
|
116
|
+
--receptor receptor.pdbqt \
|
|
117
|
+
--ligand ligand.pdbqt \
|
|
118
|
+
--output ./results \
|
|
119
|
+
--autobox-ligand reference_ligand.sdf \
|
|
120
|
+
--padding 4.0
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Scenario D: Using a Configuration File
|
|
124
|
+
|
|
125
|
+
Manage complex parameters via `config.json` or `config.yaml`:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"receptor": "./receptors_dir",
|
|
130
|
+
"ligand": "./ligands_dir",
|
|
131
|
+
"output_dir": "./results",
|
|
132
|
+
"exhaustiveness": 8,
|
|
133
|
+
"n_poses": 9,
|
|
134
|
+
"engine": "vina" // or "smina", "gnina"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
uv run bioanalyze docking run --config config.json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Scenario E: Using Smina or Gnina Engine
|
|
143
|
+
|
|
144
|
+
If `smina` or `gnina` is installed in the system PATH, you can enable them via the `--engine` parameter:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
uv run bioanalyze docking run \
|
|
148
|
+
--receptor receptor.pdbqt \
|
|
149
|
+
--ligand ligand.pdbqt \
|
|
150
|
+
--output ./results \
|
|
151
|
+
--engine gnina
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 📦 Python API
|
|
155
|
+
|
|
156
|
+
### 1. Single Docking (`run_docking`)
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from bio_analyze_docking import run_docking
|
|
160
|
+
from pathlib import Path
|
|
161
|
+
|
|
162
|
+
result = run_docking(
|
|
163
|
+
receptor=Path("receptor.pdb"), # Supports PDB/PDBQT/CIF
|
|
164
|
+
ligand=Path("ligand.sdf"), # Supports SDF/MOL2/PDB/SMILES
|
|
165
|
+
output_dir=Path("./results"),
|
|
166
|
+
center=[10.5, 20.0, 30.0], # Box center [x, y, z]
|
|
167
|
+
size=[20.0, 20.0, 20.0], # Box size [x, y, z]
|
|
168
|
+
exhaustiveness=8, # Search exhaustiveness (default 8)
|
|
169
|
+
n_poses=9, # Number of poses to output
|
|
170
|
+
output_docked_lig_recep_struct=True, # Whether to save complex PDB (requires PyMOL)
|
|
171
|
+
charge_model="gasteiger" # Charge model
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
print(f"Best Score: {result['best_score']}")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Parameters:**
|
|
178
|
+
|
|
179
|
+
- `receptor`: Receptor file path (PDB/PDBQT/CIF/MMCIF).
|
|
180
|
+
- `ligand`: Ligand file path (SDF/MOL2/PDB/SMILES).
|
|
181
|
+
- `output_dir`: Output directory.
|
|
182
|
+
- `center`: Box center `[x, y, z]`.
|
|
183
|
+
- `size`: Box size `[x, y, z]` (default `[20, 20, 20]`).
|
|
184
|
+
- `autobox_ligand`: (Optional) Reference ligand path for automatic box definition (overrides `center` and `size`).
|
|
185
|
+
- `padding`: (Optional) Automatic box padding (Angstroms).
|
|
186
|
+
- `exhaustiveness`: Vina search exhaustiveness (default 8).
|
|
187
|
+
- `n_poses`: Number of poses to generate (default 9).
|
|
188
|
+
- `output_docked_lig_recep_struct`: Whether to generate complex PDB files (default False).
|
|
189
|
+
- `charge_model`: Charge model used during receptor preparation (default 'gasteiger').
|
|
190
|
+
|
|
191
|
+
### 2. Batch Docking (`run_docking_batch`)
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
from bio_analyze_docking import run_docking_batch
|
|
195
|
+
from pathlib import Path
|
|
196
|
+
|
|
197
|
+
results = run_docking_batch(
|
|
198
|
+
receptors=Path("./receptors_dir"), # Receptor directory
|
|
199
|
+
ligands=Path("./ligands_dir"), # Ligand directory
|
|
200
|
+
output_dir=Path("./batch_results"),
|
|
201
|
+
padding=4.0, # Auto box padding
|
|
202
|
+
exhaustiveness=8
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# results is a list containing the results of each docking task
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Parameters:**
|
|
209
|
+
|
|
210
|
+
- `receptors`: Receptor directory path or list of files.
|
|
211
|
+
- `ligands`: Ligand directory path or list of files.
|
|
212
|
+
- `output_dir`: Base output directory.
|
|
213
|
+
- `summary_filename`: Summary file name (default "docking_summary.csv").
|
|
214
|
+
- Other parameters are the same as `run_docking`.
|
|
215
|
+
|
|
216
|
+
### 3. Underlying Components
|
|
217
|
+
|
|
218
|
+
You can also use the underlying preparation and engine classes independently:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
from bio_analyze_docking import prepare_receptor, prepare_ligand, DockingEngine
|
|
222
|
+
|
|
223
|
+
# Prepare files
|
|
224
|
+
rec_pdbqt = prepare_receptor("protein.pdb", "protein.pdbqt")
|
|
225
|
+
lig_pdbqt = prepare_ligand("ligand.sdf", "ligand.pdbqt")
|
|
226
|
+
|
|
227
|
+
# Initialize engine
|
|
228
|
+
engine = DockingEngine(rec_pdbqt, lig_pdbqt, output_dir=Path("./out"))
|
|
229
|
+
|
|
230
|
+
# Compute box
|
|
231
|
+
engine.compute_box(center=[0, 0, 0], size=[20, 20, 20])
|
|
232
|
+
|
|
233
|
+
# Run docking
|
|
234
|
+
engine.dock()
|
|
235
|
+
|
|
236
|
+
# Save results
|
|
237
|
+
engine.save_results("docked.pdbqt")
|
|
238
|
+
print(f"Best affinity: {engine.score()}")
|
|
239
|
+
```
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# bio-analyze-docking
|
|
2
|
+
|
|
3
|
+
An automated molecular docking module based on Vina, providing a full-pipeline solution from receptor/ligand preparation to docking simulation and result summarization. Supports both single docking and high-throughput batch docking.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- **Batch Processing**: Supports multi-to-multi (M receptors x N ligands) batch docking by specifying directories, automatically handling task scheduling.
|
|
8
|
+
- **Resumable**: Batch tasks support resuming; if interrupted, restarting will skip already completed tasks.
|
|
9
|
+
- **Wide Format Support**:
|
|
10
|
+
- **Receptor**: Supports `.pdb`, `.cif`, `.mmcif` (automatically converted to PDB).
|
|
11
|
+
- **Ligand**: Supports `.sdf`, `.mol2`, `.pdb`, `.smi` (SMILES).
|
|
12
|
+
- **Result Summarization**: Automatically generates `docking_summary.csv`, containing binding affinities, RMSD, and box parameters.
|
|
13
|
+
- **Complex Generation**: Optionally generates the docked receptor-ligand complex structure (PDB format) for easy viewing in PyMOL.
|
|
14
|
+
- **Automated Preparation**: Integrates `Meeko` and `PDBFixer` to automatically handle receptor protonation, missing atom completion, and ligand PDBQT conversion.
|
|
15
|
+
|
|
16
|
+
## 🔧 Dependencies
|
|
17
|
+
|
|
18
|
+
- **AutoDock Vina** (via Python `vina` package)
|
|
19
|
+
- **Smina** (Advanced fork of Vina, must be installed in PATH)
|
|
20
|
+
- **Gnina** (Deep learning-based docking, must be installed in PATH)
|
|
21
|
+
- **Meeko** (Ligand/Receptor preparation)
|
|
22
|
+
- **RDKit** (Chemical informatics)
|
|
23
|
+
- **OpenBabel** (Backup for receptor preparation)
|
|
24
|
+
- **Gemmi** (CIF/mmCIF support)
|
|
25
|
+
- **PDBFixer** (Receptor repair)
|
|
26
|
+
|
|
27
|
+
## 🚀 Usage
|
|
28
|
+
|
|
29
|
+
### 1. Receptor Preparation
|
|
30
|
+
|
|
31
|
+
Converts PDB/CIF files to PDBQT format, automatically adding polar hydrogens.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Single file
|
|
35
|
+
uv run bioanalyze docking prepare-receptor receptor.pdb -o receptor.pdbqt
|
|
36
|
+
|
|
37
|
+
# CIF format support
|
|
38
|
+
uv run bioanalyze docking prepare-receptor structure.cif -o structure.pdbqt
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Ligand Preparation
|
|
42
|
+
|
|
43
|
+
Converts SDF/SMILES/PDB files to PDBQT format, automatically generating 3D conformations and handling flexible bonds.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv run bioanalyze docking prepare-ligand ligand.sdf -o ligand.pdbqt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Run Docking
|
|
50
|
+
|
|
51
|
+
#### Scenario A: Single Docking
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
uv run bioanalyze docking run \
|
|
55
|
+
--receptor receptor.pdbqt \
|
|
56
|
+
--ligand ligand.pdbqt \
|
|
57
|
+
--output ./results \
|
|
58
|
+
--center-x 10.5 --center-y 20.0 --center-z 30.0 \
|
|
59
|
+
--size-x 20 --size-y 20 --size-z 20
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Scenario B: Batch Docking
|
|
63
|
+
|
|
64
|
+
Simply specify `--receptor` or `--ligand` as directories, and the program will automatically scan for all supported files and perform pairwise docking.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
uv run bioanalyze docking run \
|
|
68
|
+
--receptor ./receptors_dir \
|
|
69
|
+
--ligand ./ligands_dir \
|
|
70
|
+
--output ./batch_results \
|
|
71
|
+
--padding 4.0 # Automatically calculate the box based on the receptor and add 4.0A padding
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Batch Docking Output Structure:**
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
batch_results/
|
|
78
|
+
├── dock_results/
|
|
79
|
+
│ ├── poses/ # Docked poses (PDBQT)
|
|
80
|
+
│ │ └── receptor_name/
|
|
81
|
+
│ │ └── ligand_name_docked.pdbqt
|
|
82
|
+
│ └── complex/ # (Optional) Complex structures (PDB)
|
|
83
|
+
├── docking_summary.csv # Summary table (contains Affinity, RMSD, etc.)
|
|
84
|
+
├── logs/ # Independent logs for each task
|
|
85
|
+
└── configs.json # Run configuration record
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Scenario C: Autoboxing based on Reference Ligand
|
|
89
|
+
|
|
90
|
+
Use a co-crystallized ligand to automatically determine the docking center and extent.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
uv run bioanalyze docking run \
|
|
94
|
+
--receptor receptor.pdbqt \
|
|
95
|
+
--ligand ligand.pdbqt \
|
|
96
|
+
--output ./results \
|
|
97
|
+
--autobox-ligand reference_ligand.sdf \
|
|
98
|
+
--padding 4.0
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Scenario D: Using a Configuration File
|
|
102
|
+
|
|
103
|
+
Manage complex parameters via `config.json` or `config.yaml`:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"receptor": "./receptors_dir",
|
|
108
|
+
"ligand": "./ligands_dir",
|
|
109
|
+
"output_dir": "./results",
|
|
110
|
+
"exhaustiveness": 8,
|
|
111
|
+
"n_poses": 9,
|
|
112
|
+
"engine": "vina" // or "smina", "gnina"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uv run bioanalyze docking run --config config.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Scenario E: Using Smina or Gnina Engine
|
|
121
|
+
|
|
122
|
+
If `smina` or `gnina` is installed in the system PATH, you can enable them via the `--engine` parameter:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
uv run bioanalyze docking run \
|
|
126
|
+
--receptor receptor.pdbqt \
|
|
127
|
+
--ligand ligand.pdbqt \
|
|
128
|
+
--output ./results \
|
|
129
|
+
--engine gnina
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 📦 Python API
|
|
133
|
+
|
|
134
|
+
### 1. Single Docking (`run_docking`)
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from bio_analyze_docking import run_docking
|
|
138
|
+
from pathlib import Path
|
|
139
|
+
|
|
140
|
+
result = run_docking(
|
|
141
|
+
receptor=Path("receptor.pdb"), # Supports PDB/PDBQT/CIF
|
|
142
|
+
ligand=Path("ligand.sdf"), # Supports SDF/MOL2/PDB/SMILES
|
|
143
|
+
output_dir=Path("./results"),
|
|
144
|
+
center=[10.5, 20.0, 30.0], # Box center [x, y, z]
|
|
145
|
+
size=[20.0, 20.0, 20.0], # Box size [x, y, z]
|
|
146
|
+
exhaustiveness=8, # Search exhaustiveness (default 8)
|
|
147
|
+
n_poses=9, # Number of poses to output
|
|
148
|
+
output_docked_lig_recep_struct=True, # Whether to save complex PDB (requires PyMOL)
|
|
149
|
+
charge_model="gasteiger" # Charge model
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
print(f"Best Score: {result['best_score']}")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Parameters:**
|
|
156
|
+
|
|
157
|
+
- `receptor`: Receptor file path (PDB/PDBQT/CIF/MMCIF).
|
|
158
|
+
- `ligand`: Ligand file path (SDF/MOL2/PDB/SMILES).
|
|
159
|
+
- `output_dir`: Output directory.
|
|
160
|
+
- `center`: Box center `[x, y, z]`.
|
|
161
|
+
- `size`: Box size `[x, y, z]` (default `[20, 20, 20]`).
|
|
162
|
+
- `autobox_ligand`: (Optional) Reference ligand path for automatic box definition (overrides `center` and `size`).
|
|
163
|
+
- `padding`: (Optional) Automatic box padding (Angstroms).
|
|
164
|
+
- `exhaustiveness`: Vina search exhaustiveness (default 8).
|
|
165
|
+
- `n_poses`: Number of poses to generate (default 9).
|
|
166
|
+
- `output_docked_lig_recep_struct`: Whether to generate complex PDB files (default False).
|
|
167
|
+
- `charge_model`: Charge model used during receptor preparation (default 'gasteiger').
|
|
168
|
+
|
|
169
|
+
### 2. Batch Docking (`run_docking_batch`)
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from bio_analyze_docking import run_docking_batch
|
|
173
|
+
from pathlib import Path
|
|
174
|
+
|
|
175
|
+
results = run_docking_batch(
|
|
176
|
+
receptors=Path("./receptors_dir"), # Receptor directory
|
|
177
|
+
ligands=Path("./ligands_dir"), # Ligand directory
|
|
178
|
+
output_dir=Path("./batch_results"),
|
|
179
|
+
padding=4.0, # Auto box padding
|
|
180
|
+
exhaustiveness=8
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
# results is a list containing the results of each docking task
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Parameters:**
|
|
187
|
+
|
|
188
|
+
- `receptors`: Receptor directory path or list of files.
|
|
189
|
+
- `ligands`: Ligand directory path or list of files.
|
|
190
|
+
- `output_dir`: Base output directory.
|
|
191
|
+
- `summary_filename`: Summary file name (default "docking_summary.csv").
|
|
192
|
+
- Other parameters are the same as `run_docking`.
|
|
193
|
+
|
|
194
|
+
### 3. Underlying Components
|
|
195
|
+
|
|
196
|
+
You can also use the underlying preparation and engine classes independently:
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
from bio_analyze_docking import prepare_receptor, prepare_ligand, DockingEngine
|
|
200
|
+
|
|
201
|
+
# Prepare files
|
|
202
|
+
rec_pdbqt = prepare_receptor("protein.pdb", "protein.pdbqt")
|
|
203
|
+
lig_pdbqt = prepare_ligand("ligand.sdf", "ligand.pdbqt")
|
|
204
|
+
|
|
205
|
+
# Initialize engine
|
|
206
|
+
engine = DockingEngine(rec_pdbqt, lig_pdbqt, output_dir=Path("./out"))
|
|
207
|
+
|
|
208
|
+
# Compute box
|
|
209
|
+
engine.compute_box(center=[0, 0, 0], size=[20, 20, 20])
|
|
210
|
+
|
|
211
|
+
# Run docking
|
|
212
|
+
engine.dock()
|
|
213
|
+
|
|
214
|
+
# Save results
|
|
215
|
+
engine.save_results("docked.pdbqt")
|
|
216
|
+
print(f"Best affinity: {engine.score()}")
|
|
217
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prepare-ligand",
|
|
3
|
+
"description": {
|
|
4
|
+
"en": "",
|
|
5
|
+
"zh": ""
|
|
6
|
+
},
|
|
7
|
+
"params": [
|
|
8
|
+
{
|
|
9
|
+
"name": "--input-file",
|
|
10
|
+
"type": "path",
|
|
11
|
+
"required": true,
|
|
12
|
+
"default": null,
|
|
13
|
+
"description": {
|
|
14
|
+
"en": "输入配体文件 (SDF, SMILES, PDB)。",
|
|
15
|
+
"zh": "输入配体文件 (SDF, SMILES, PDB)。"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "-o, --output",
|
|
20
|
+
"type": "path",
|
|
21
|
+
"required": true,
|
|
22
|
+
"default": null,
|
|
23
|
+
"description": {
|
|
24
|
+
"en": "输出 PDBQT 文件。",
|
|
25
|
+
"zh": "输出 PDBQT 文件。"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "--add-hydrogens",
|
|
30
|
+
"type": "bool",
|
|
31
|
+
"required": false,
|
|
32
|
+
"default": "True",
|
|
33
|
+
"description": {
|
|
34
|
+
"en": "添加氢原子。",
|
|
35
|
+
"zh": "添加氢原子。"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prepare-ligand",
|
|
3
|
+
"type": "cli",
|
|
4
|
+
"description": {
|
|
5
|
+
"zh": "",
|
|
6
|
+
"en": ""
|
|
7
|
+
},
|
|
8
|
+
"params": [
|
|
9
|
+
{
|
|
10
|
+
"name": "--input-file",
|
|
11
|
+
"type": "path",
|
|
12
|
+
"required": true,
|
|
13
|
+
"default": null,
|
|
14
|
+
"description": {
|
|
15
|
+
"zh": "输入配体文件 (SDF, SMILES, PDB)。",
|
|
16
|
+
"en": "Input ligand file (SDF, SMILES, PDB)."
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "-o, --output",
|
|
21
|
+
"type": "path",
|
|
22
|
+
"required": true,
|
|
23
|
+
"default": null,
|
|
24
|
+
"description": {
|
|
25
|
+
"zh": "输出 PDBQT 文件。",
|
|
26
|
+
"en": "Output PDBQT file."
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "--add-hydrogens",
|
|
31
|
+
"type": "bool",
|
|
32
|
+
"required": false,
|
|
33
|
+
"default": "True",
|
|
34
|
+
"description": {
|
|
35
|
+
"zh": "添加氢原子。",
|
|
36
|
+
"en": "Add hydrogens."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prepare-receptor",
|
|
3
|
+
"description": {
|
|
4
|
+
"en": "",
|
|
5
|
+
"zh": ""
|
|
6
|
+
},
|
|
7
|
+
"params": [
|
|
8
|
+
{
|
|
9
|
+
"name": "--input-file",
|
|
10
|
+
"type": "path",
|
|
11
|
+
"required": true,
|
|
12
|
+
"default": null,
|
|
13
|
+
"description": {
|
|
14
|
+
"en": "输入受体文件 (PDB)。",
|
|
15
|
+
"zh": "输入受体文件 (PDB)。"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "-o, --output",
|
|
20
|
+
"type": "path",
|
|
21
|
+
"required": true,
|
|
22
|
+
"default": null,
|
|
23
|
+
"description": {
|
|
24
|
+
"en": "输出 PDBQT 文件。",
|
|
25
|
+
"zh": "输出 PDBQT 文件。"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "--add-hydrogens",
|
|
30
|
+
"type": "bool",
|
|
31
|
+
"required": false,
|
|
32
|
+
"default": "True",
|
|
33
|
+
"description": {
|
|
34
|
+
"en": "添加氢原子。",
|
|
35
|
+
"zh": "添加氢原子。"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "--charge-model",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"required": false,
|
|
42
|
+
"default": "gasteiger",
|
|
43
|
+
"description": {
|
|
44
|
+
"en": "电荷模型 (gasteiger, zero 等)。",
|
|
45
|
+
"zh": "电荷模型 (gasteiger, zero 等)。"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prepare-receptor",
|
|
3
|
+
"type": "cli",
|
|
4
|
+
"description": {
|
|
5
|
+
"zh": "",
|
|
6
|
+
"en": ""
|
|
7
|
+
},
|
|
8
|
+
"params": [
|
|
9
|
+
{
|
|
10
|
+
"name": "--input-file",
|
|
11
|
+
"type": "path",
|
|
12
|
+
"required": true,
|
|
13
|
+
"default": null,
|
|
14
|
+
"description": {
|
|
15
|
+
"zh": "输入受体文件 (PDB)。",
|
|
16
|
+
"en": "Input receptor file (PDB)."
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "-o, --output",
|
|
21
|
+
"type": "path",
|
|
22
|
+
"required": true,
|
|
23
|
+
"default": null,
|
|
24
|
+
"description": {
|
|
25
|
+
"zh": "输出 PDBQT 文件。",
|
|
26
|
+
"en": "Output PDBQT file."
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "--add-hydrogens",
|
|
31
|
+
"type": "bool",
|
|
32
|
+
"required": false,
|
|
33
|
+
"default": "True",
|
|
34
|
+
"description": {
|
|
35
|
+
"zh": "添加氢原子。",
|
|
36
|
+
"en": "Add hydrogens."
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "--charge-model",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"required": false,
|
|
43
|
+
"default": "gasteiger",
|
|
44
|
+
"description": {
|
|
45
|
+
"zh": "电荷模型 (gasteiger, zero 等)。",
|
|
46
|
+
"en": "Charge model (gasteiger, zero, etc.)."
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|