pandadock 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pritam Kumar Panda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+ include requirements.txt
4
+ recursive-include examples *.py
5
+ recursive-include tests *.py
@@ -0,0 +1,408 @@
1
+ Metadata-Version: 2.4
2
+ Name: pandadock
3
+ Version: 0.1.0
4
+ Summary: A GPU-accelerated molecular docking tool for computational drug discovery
5
+ Home-page: https://github.com/pritampanda15/pandadock
6
+ Author: Dr. Pritam Kumar Panda
7
+ Author-email: pritam@stanford.edu
8
+ Project-URL: Bug Tracker, https://github.com/pritampanda15/pandadock/issues
9
+ Project-URL: Documentation, https://github.com/pritampanda15/pandadock/wiki
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.7
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
17
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
18
+ Requires-Python: >=3.7
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: numpy>=1.19.0
22
+ Requires-Dist: scipy>=1.5.0
23
+ Requires-Dist: matplotlib>=3.3.0
24
+ Requires-Dist: scikit-learn>=0.24.0
25
+ Provides-Extra: gpu
26
+ Requires-Dist: torch>=1.9.0; extra == "gpu"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=6.0.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=2.10.0; extra == "dev"
30
+ Requires-Dist: black>=20.8b1; extra == "dev"
31
+ Requires-Dist: flake8>=3.8.0; extra == "dev"
32
+ Provides-Extra: rdkit
33
+ Requires-Dist: rdkit>=2020.09.1; extra == "rdkit"
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: license-file
41
+ Dynamic: project-url
42
+ Dynamic: provides-extra
43
+ Dynamic: requires-dist
44
+ Dynamic: requires-python
45
+ Dynamic: summary
46
+
47
+ # PandaDock: Python-based molecular docking software for bioinformatics and drug design with physics-based approach
48
+
49
+ PandaDock is a Python-based molecular docking package designed for bioinformatics and drug design applications. It provides a command-line interface for molecular docking simulations, with support for multiple scoring functions and search algorithms.
50
+
51
+ ![PandaDock Logo](logo/pandadock-logo.svg)
52
+
53
+ ## Features
54
+
55
+ - 🔬 PDB and MOL/SDF file parsing
56
+ - 🎯 Active site definition and automatic pocket detection
57
+ - 📊 Multiple scoring functions:
58
+ - Basic: van der Waals and hydrogen bonds
59
+ - Enhanced: electrostatics, desolvation, and hydrophobic interactions
60
+ - Physics-based: MM-GBSA inspired scoring with full molecular mechanics
61
+ - 🧬 Advanced search algorithms:
62
+ - Random search
63
+ - Genetic algorithm with local optimization
64
+ - Monte Carlo sampling with simulated annealing
65
+ - 🔄 Molecule preparation with hydrogen addition and energy minimization
66
+ - 📏 Validation against reference structures with RMSD calculations
67
+ - 📈 Comprehensive results visualization and analysis
68
+ - ⚡ Hardware acceleration:
69
+ - Multi-core CPU parallelization
70
+ - GPU acceleration for scoring functions
71
+ - Hybrid CPU/GPU workload balancing
72
+
73
+ ## Installation
74
+
75
+ ### Prerequisites
76
+
77
+ PandaDock requires Python 3.6+ and the following dependencies:
78
+ - NumPy
79
+ - SciPy
80
+ - Matplotlib
81
+ - scikit-learn
82
+ - RDKit (optional but recommended)
83
+ - Open Babel (optional for additional molecule preparation)
84
+ - PyTorch or CuPy (optional for GPU acceleration)
85
+
86
+ ### Install from GitHub
87
+
88
+ ```bash
89
+ # Clone the repository
90
+ git clone https://github.com/pritampanda15/PandaDock.git
91
+
92
+ # Navigate to the directory
93
+ cd PandaDock
94
+
95
+ # Install the package
96
+ pip install -e .
97
+ ```
98
+
99
+ ### Install RDKit (Optional but Recommended)
100
+
101
+ For better molecular handling, it's recommended to install RDKit:
102
+
103
+ ```bash
104
+ conda install -c conda-forge rdkit
105
+ ```
106
+
107
+ ### Install Open Babel (Optional)
108
+
109
+ For advanced molecule preparation:
110
+
111
+ ```bash
112
+ conda install -c conda-forge openbabel
113
+ ```
114
+
115
+ ### Install GPU Acceleration (Optional)
116
+
117
+ For GPU-accelerated docking:
118
+
119
+ ```bash
120
+ # PyTorch with CUDA support
121
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
122
+
123
+ # OR CuPy
124
+ pip install cupy-cuda11x
125
+ ```
126
+
127
+ ## Usage
128
+
129
+ ### Command Line Interface
130
+
131
+ ```bash
132
+ # Basic usage
133
+ pandadock -p protein.pdb -l ligand.mol -o results
134
+
135
+ # Use genetic algorithm with 2000 iterations
136
+ pandadock -p protein.pdb -l ligand.mol -a genetic -i 2000 -o results
137
+
138
+ # Specify active site
139
+ pandadock -p protein.pdb -l ligand.mol -s 10.0 20.0 30.0 -r 12.0 -o results
140
+
141
+ # Automatic pocket detection
142
+ pandadock -p protein.pdb -l ligand.mol --detect-pockets -o results
143
+
144
+ # Enhanced docking with all features
145
+ pandadock -p protein.pdb -l ligand.mol --enhanced-scoring --prepare-molecules --local-opt -i 1000 --exhaustiveness 5
146
+ ```
147
+
148
+ ### Running Modes
149
+
150
+ PandaDock offers flexible running modes to balance between speed and accuracy:
151
+
152
+ - **Fast Mode**: `--fast-mode` - Quick docking with minimal enhancements
153
+ - **Default Mode**: Basic docking with standard scoring
154
+ - **Enhanced Mode**: Use any combination of enhancement flags:
155
+ - `--enhanced-scoring` - More accurate scoring with electrostatics
156
+ - `--local-opt` - Fine-tune top poses for better results
157
+ - `--exhaustiveness 5` - Run multiple independent searches
158
+ - `--prepare-molecules` - Optimize molecule geometry before docking
159
+
160
+ ### Physics-Based Docking
161
+
162
+ ```bash
163
+ # Use MMFF94 minimization (requires RDKit)
164
+ pandadock -p protein.pdb -l ligand.mol --mmff-minimization
165
+
166
+ # Enhanced electrostatics with solvation
167
+ pandadock -p protein.pdb -l ligand.mol --enhanced-scoring
168
+
169
+ # Full physics-based scoring (MM-GBSA inspired)
170
+ pandadock -p protein.pdb -l ligand.mol --physics-based
171
+
172
+ # Monte Carlo sampling with simulated annealing
173
+ pandadock -p protein.pdb -l ligand.mol --monte-carlo --mc-steps 2000 --temperature 300
174
+
175
+ # Combined approach for best accuracy
176
+ pandadock -p protein.pdb -l ligand.mol --physics-based --mmff-minimization --local-opt
177
+ ```
178
+
179
+ ### Hardware Acceleration
180
+
181
+ ```bash
182
+ # Enable GPU acceleration (if available)
183
+ pandadock -p protein.pdb -l ligand.mol --use-gpu
184
+
185
+ # Specify CPU workers for parallelization
186
+ pandadock -p protein.pdb -l ligand.mol --cpu-workers 8
187
+
188
+ # Auto-tune hardware settings for optimal performance
189
+ pandadock -p protein.pdb -l ligand.mol --auto-tune
190
+
191
+ # Combine hardware acceleration with physics-based methods
192
+ pandadock -p protein.pdb -l ligand.mol --use-gpu --physics-based --mmff-minimization
193
+ ```
194
+
195
+ ### Python API
196
+
197
+ ```python
198
+ from pandadock.protein import Protein
199
+ from pandadock.ligand import Ligand
200
+ from pandadock.scoring import CompositeScoringFunction, EnhancedScoringFunction
201
+ from pandadock.search import GeneticAlgorithm
202
+ from pandadock.utils import save_docking_results
203
+ from pandadock.preparation import prepare_protein, prepare_ligand
204
+
205
+ # Prepare molecules (optional)
206
+ prepared_protein = prepare_protein("protein.pdb", add_hydrogens=True, ph=7.4)
207
+ prepared_ligand = prepare_ligand("ligand.mol", minimize=True)
208
+
209
+ # Load protein and ligand
210
+ protein = Protein(prepared_protein)
211
+ ligand = Ligand(prepared_ligand)
212
+
213
+ # Define active site (optional)
214
+ protein.define_active_site([10.0, 20.0, 30.0], 12.0)
215
+
216
+ # Create scoring function (choose basic or enhanced)
217
+ scoring_function = EnhancedScoringFunction() # or CompositeScoringFunction()
218
+
219
+ # Create search algorithm
220
+ search_algorithm = GeneticAlgorithm(
221
+ scoring_function,
222
+ max_iterations=1000,
223
+ population_size=100,
224
+ mutation_rate=0.3
225
+ )
226
+
227
+ # Perform docking
228
+ results = search_algorithm.search(protein, ligand)
229
+
230
+ # Apply local optimization (optional)
231
+ optimized_results = []
232
+ for i, (pose, score) in enumerate(sorted(results, key=lambda x: x[1])[:5]):
233
+ opt_pose, opt_score = search_algorithm._local_optimization(pose, protein)
234
+ optimized_results.append((opt_pose, opt_score))
235
+
236
+ # Save results
237
+ save_docking_results(optimized_results, "docking_results")
238
+ ```
239
+
240
+ ## Command Line Arguments
241
+
242
+ | Argument | Description |
243
+ |----------|-------------|
244
+ | `-p, --protein` | Path to protein PDB file |
245
+ | `-l, --ligand` | Path to ligand MOL/SDF file |
246
+ | `-o, --output` | Output directory for results (default: docking_results) |
247
+ | `-a, --algorithm` | Docking algorithm: 'random' or 'genetic' (default: genetic) |
248
+ | `-i, --iterations` | Number of iterations/generations (default: 1000) |
249
+ | `-s, --site` | Active site center coordinates (x y z) |
250
+ | `-r, --radius` | Active site radius in Angstroms (default: 10.0) |
251
+ | `--detect-pockets` | Automatically detect binding pockets |
252
+
253
+ ### Enhancement Options
254
+ | Argument | Description |
255
+ |----------|-------------|
256
+ | `--fast-mode` | Run with minimal enhancements for quick results |
257
+ | `--enhanced` | Use enhanced algorithms for more accurate (but slower) results |
258
+ | `--enhanced-scoring` | Use enhanced scoring function with electrostatics |
259
+ | `--prepare-molecules` | Prepare protein and ligand before docking |
260
+ | `--population-size` | Population size for genetic algorithm (default: 100) |
261
+ | `--exhaustiveness` | Number of independent docking runs (default: 1) |
262
+ | `--local-opt` | Perform local optimization on top poses |
263
+ | `--ph` | pH for protein preparation (default: 7.4) |
264
+ | `--reference` | Reference ligand structure for validation |
265
+
266
+ ### Physics-Based Options
267
+ | Argument | Description |
268
+ |----------|-------------|
269
+ | `--physics-based` | Use full physics-based scoring (MM-GBSA inspired) |
270
+ | `--mmff-minimization` | Use MMFF94 force field minimization (requires RDKit) |
271
+ | `--monte-carlo` | Use Monte Carlo sampling instead of genetic algorithm |
272
+ | `--mc-steps` | Number of Monte Carlo steps (default: 1000) |
273
+ | `--temperature` | Temperature for Monte Carlo simulation in Kelvin (default: 300K) |
274
+
275
+ ### Hardware Acceleration Options
276
+ | Argument | Description |
277
+ |----------|-------------|
278
+ | `--use-gpu` | Use GPU acceleration if available |
279
+ | `--gpu-id` | GPU device ID to use (default: 0) |
280
+ | `--gpu-precision` | Numerical precision for GPU: 'float32' or 'float64' (default: 'float32') |
281
+ | `--cpu-workers` | Number of CPU workers for parallel processing (default: all cores) |
282
+ | `--cpu-affinity` | Set CPU affinity for better performance |
283
+ | `--workload-balance` | GPU/CPU workload balance (0.0-1.0, higher values assign more work to GPU) |
284
+ | `--auto-tune` | Automatically tune hardware parameters for best performance |
285
+
286
+ ## Examples
287
+
288
+ ### Example 1: Basic Docking
289
+
290
+ ```bash
291
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf -o results_receptor
292
+ ```
293
+
294
+ ### Example 2: Enhanced Docking with Local Optimization
295
+
296
+ ```bash
297
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf --enhanced-scoring --local-opt -i 1000 -o results_enhanced
298
+ ```
299
+
300
+ ### Example 3: Molecule Preparation and Multiple Runs
301
+
302
+ ```bash
303
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf --prepare-molecules --exhaustiveness 5 -o results_ensemble
304
+ ```
305
+
306
+ ### Example 4: Validation Against Reference Structure
307
+
308
+ ```bash
309
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf --reference tests/indinavir_xray.mol --enhanced-scoring -o results_validation
310
+ ```
311
+
312
+ ### Example 5: Physics-Based Docking
313
+
314
+ ```bash
315
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf --physics-based --mmff-minimization --local-opt -o results_physics
316
+ ```
317
+
318
+ ### Example 6: GPU-Accelerated Docking
319
+
320
+ ```bash
321
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf --use-gpu --enhanced-scoring -o results_gpu
322
+ ```
323
+
324
+ ### Example 7: Replicating a Known Protein-Ligand Complex
325
+
326
+ ```bash
327
+ pandadock -p tests/receptor.pdb -l tests/ligand.sdf -s 110.13 136.34 141.95 -r 4.0 \
328
+ --physics-based --mmff-minimization --local-opt --use-gpu -i 50 -o results_complex
329
+ ```
330
+
331
+ ## Physics-Based Features
332
+
333
+ PandaDock now includes physics-based molecular modeling capabilities that significantly enhance the accuracy of docking results. These advanced features provide more realistic molecular interactions based on established physical principles.
334
+
335
+ - **MMFF94 Force Field Minimization**: Full molecular mechanics energy minimization using the Merck Molecular Force Field.
336
+ - **Enhanced Electrostatics**: Poisson-Boltzmann inspired model with distance-dependent dielectric and salt screening effects.
337
+ - **Implicit Solvation (GB/SA)**: Generalized Born model with surface area-based nonpolar term to account for solvent effects.
338
+ - **Monte Carlo Sampling**: Enhanced conformational sampling with Metropolis criterion and simulated annealing capability.
339
+ - **Physics-Based Scoring**: Complete MM-GBSA inspired scoring that combines molecular mechanics with implicit solvation.
340
+
341
+ ## How These Methods Compare to Commercial Software
342
+
343
+ PandaDock's physics-based features are inspired by approaches used in commercial packages like Discovery Studio:
344
+
345
+ | Feature | PandaDock Implementation | Commercial Equivalent |
346
+ |---------|--------------------------|----------------------|
347
+ | Force Field | MMFF94 via RDKit | CHARMM, CDOCKER |
348
+ | Electrostatics | Modified PB model | Poisson-Boltzmann solver |
349
+ | Solvation | Simplified GB/SA | MM-GBSA |
350
+ | Sampling | Monte Carlo with annealing | Simulated annealing |
351
+ | Minimization | Gradient-based optimization | Energy minimization |
352
+
353
+ ## Hardware Acceleration
354
+
355
+ PandaDock implements hardware acceleration to significantly improve performance:
356
+
357
+ - **Multi-core CPU Parallelization**: Distributes workload across available CPU cores
358
+ - **GPU Acceleration**: Uses CUDA-capable GPUs via PyTorch or CuPy for compute-intensive calculations
359
+ - **Hybrid CPU/GPU Mode**: Intelligently balances workload between CPU and GPU resources
360
+ - **Auto-tuning**: Automatically detects and configures optimal hardware settings
361
+
362
+ ### Performance Considerations
363
+
364
+ The physics-based methods are significantly more computationally intensive than standard docking approaches:
365
+
366
+ - **Standard docking**: Seconds to minutes
367
+ - **Enhanced scoring**: Minutes
368
+ - **MMFF minimization**: Minutes to tens of minutes
369
+ - **Physics-based scoring**: Tens of minutes to hours
370
+ - **Monte Carlo sampling**: Hours
371
+
372
+ GPU acceleration can provide significant speedups (5-20x) for scoring functions, especially when using physics-based methods.
373
+
374
+ ## Understanding Results
375
+
376
+ PandaDock generates several output files in the specified directory:
377
+
378
+ 1. **Docking poses (PDB files)**: Top-scoring ligand conformations
379
+ 2. **Score plot (PNG)**: Visualization of score distribution
380
+ 3. **Docking results (TXT)**: Detailed results with scores and statistics
381
+ 4. **Validation report (TXT)**: RMSD analysis if reference structure provided
382
+
383
+ ## Contributing
384
+
385
+ Contributions are welcome! Please feel free to submit a Pull Request.
386
+
387
+ 1. Fork the repository
388
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
389
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
390
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
391
+ 5. Open a Pull Request
392
+
393
+ ## License
394
+
395
+ This project is licensed under the MIT License - see the LICENSE file for details.
396
+
397
+ ## Citation
398
+
399
+ If you use PandaDock in your research, please cite:
400
+
401
+ ```
402
+ Pritam Kumar Panda. (2025). PandaDock: Python Molecular Docking. GitHub repository. https://github.com/pritampanda15/PandaDock
403
+ ```
404
+
405
+ ## Acknowledgments
406
+
407
+ - Thanks to everyone who contributed to this project
408
+ - Inspiration from established docking software like AutoDock, Vina, etc.