$npx -y skills add LeonChaoX/qinyan-academic-skills --skill diffdockDiffusion-based molecular docking. Predict protein-ligand binding poses from PDB/SMILES, confidence scores, virtual screening, for structure-based drug design. Not for affinity prediction.
| 1 | # DiffDock: Molecular Docking with Diffusion Models |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | DiffDock is a diffusion-based deep learning tool for molecular docking that predicts 3D binding poses of small molecule ligands to protein targets. It represents the state-of-the-art in computational docking, crucial for structure-based drug discovery and chemical biology. |
| 6 | |
| 7 | **Core Capabilities:** |
| 8 | - Predict ligand binding poses with high accuracy using deep learning |
| 9 | - Support protein structures (PDB files) or sequences (via ESMFold) |
| 10 | - Process single complexes or batch virtual screening campaigns |
| 11 | - Generate confidence scores to assess prediction reliability |
| 12 | - Handle diverse ligand inputs (SMILES, SDF, MOL2) |
| 13 | |
| 14 | **Key Distinction:** DiffDock predicts **binding poses** (3D structure) and **confidence** (prediction certainty), NOT binding affinity (ΔG, Kd). Always combine with scoring functions (GNINA, MM/GBSA) for affinity assessment. |
| 15 | |
| 16 | ## When to Use This Skill |
| 17 | |
| 18 | This skill should be used when: |
| 19 | |
| 20 | - "Dock this ligand to a protein" or "predict binding pose" |
| 21 | - "Run molecular docking" or "perform protein-ligand docking" |
| 22 | - "Virtual screening" or "screen compound library" |
| 23 | - "Where does this molecule bind?" or "predict binding site" |
| 24 | - Structure-based drug design or lead optimization tasks |
| 25 | - Tasks involving PDB files + SMILES strings or ligand structures |
| 26 | - Batch docking of multiple protein-ligand pairs |
| 27 | |
| 28 | ## Installation and Environment Setup |
| 29 | |
| 30 | ### Check Environment Status |
| 31 | |
| 32 | Before proceeding with DiffDock tasks, verify the environment setup: |
| 33 | |
| 34 | ```bash |
| 35 | # Use the provided setup checker |
| 36 | python scripts/setup_check.py |
| 37 | ``` |
| 38 | |
| 39 | This script validates Python version, PyTorch with CUDA, PyTorch Geometric, RDKit, ESM, and other dependencies. |
| 40 | |
| 41 | ### Installation Options |
| 42 | |
| 43 | **Option 1: Conda (Recommended)** |
| 44 | ```bash |
| 45 | git clone https://github.com/gcorso/DiffDock.git |
| 46 | cd DiffDock |
| 47 | conda env create --file environment.yml |
| 48 | conda activate diffdock |
| 49 | ``` |
| 50 | |
| 51 | **Option 2: Docker** |
| 52 | ```bash |
| 53 | docker pull rbgcsail/diffdock |
| 54 | docker run -it --gpus all --entrypoint /bin/bash rbgcsail/diffdock |
| 55 | micromamba activate diffdock |
| 56 | ``` |
| 57 | |
| 58 | **Important Notes:** |
| 59 | - GPU strongly recommended (10-100x speedup vs CPU) |
| 60 | - First run pre-computes SO(2)/SO(3) lookup tables (~2-5 minutes) |
| 61 | - Model checkpoints (~500MB) download automatically if not present |
| 62 | |
| 63 | ## Core Workflows |
| 64 | |
| 65 | ### Workflow 1: Single Protein-Ligand Docking |
| 66 | |
| 67 | **Use Case:** Dock one ligand to one protein target |
| 68 | |
| 69 | **Input Requirements:** |
| 70 | - Protein: PDB file OR amino acid sequence |
| 71 | - Ligand: SMILES string OR structure file (SDF/MOL2) |
| 72 | |
| 73 | **Command:** |
| 74 | ```bash |
| 75 | python -m inference \ |
| 76 | --config default_inference_args.yaml \ |
| 77 | --protein_path protein.pdb \ |
| 78 | --ligand "CC(=O)Oc1ccccc1C(=O)O" \ |
| 79 | --out_dir results/single_docking/ |
| 80 | ``` |
| 81 | |
| 82 | **Alternative (protein sequence):** |
| 83 | ```bash |
| 84 | python -m inference \ |
| 85 | --config default_inference_args.yaml \ |
| 86 | --protein_sequence "MSKGEELFTGVVPILVELDGDVNGHKF..." \ |
| 87 | --ligand ligand.sdf \ |
| 88 | --out_dir results/sequence_docking/ |
| 89 | ``` |
| 90 | |
| 91 | **Output Structure:** |
| 92 | ``` |
| 93 | results/single_docking/ |
| 94 | ├── rank_1.sdf # Top-ranked pose |
| 95 | ├── rank_2.sdf # Second-ranked pose |
| 96 | ├── ... |
| 97 | ├── rank_10.sdf # 10th pose (default: 10 samples) |
| 98 | └── confidence_scores.txt |
| 99 | ``` |
| 100 | |
| 101 | ### Workflow 2: Batch Processing Multiple Complexes |
| 102 | |
| 103 | **Use Case:** Dock multiple ligands to proteins, virtual screening campaigns |
| 104 | |
| 105 | **Step 1: Prepare Batch CSV** |
| 106 | |
| 107 | Use the provided script to create or validate batch input: |
| 108 | |
| 109 | ```bash |
| 110 | # Create template |
| 111 | python scripts/prepare_batch_csv.py --create --output batch_input.csv |
| 112 | |
| 113 | # Validate existing CSV |
| 114 | python scripts/prepare_batch_csv.py my_input.csv --validate |
| 115 | ``` |
| 116 | |
| 117 | **CSV Format:** |
| 118 | ```csv |
| 119 | complex_name,protein_path,ligand_description,protein_sequence |
| 120 | complex1,protein1.pdb,CC(=O)Oc1ccccc1C(=O)O, |
| 121 | complex2,,COc1ccc(C#N)cc1,MSKGEELFT... |
| 122 | complex3,protein3.pdb,ligand3.sdf, |
| 123 | ``` |
| 124 | |
| 125 | **Required Columns:** |
| 126 | - `complex_name`: Unique identifier |
| 127 | - `protein_path`: PDB file path (leave empty if using sequence) |
| 128 | - `ligand_description`: SMILES string or ligand file path |
| 129 | - `protein_sequence`: Amino acid sequence (leave empty if using PDB) |
| 130 | |
| 131 | **Step 2: Run Batch Docking** |
| 132 | |
| 133 | ```bash |
| 134 | python -m inference \ |
| 135 | --config default_inference_args.yaml \ |
| 136 | --protein_ligand_csv batch_input.csv \ |
| 137 | --out_dir results/batch/ \ |
| 138 | --batch_size 10 |
| 139 | ``` |
| 140 | |
| 141 | **For Large Virtual Screening (>100 compounds):** |
| 142 | |
| 143 | Pre-compute protein embeddings for faster processing: |
| 144 | ```bash |
| 145 | # Pre-compute embeddings |
| 146 | python datasets/esm_embedding_preparation.py \ |
| 147 | --protein_ligand_csv screening_input.csv \ |
| 148 | --out_file protein_embeddings.pt |
| 149 | |
| 150 | # Run with pre-computed embeddings |
| 151 | python -m inference \ |
| 152 | --config default_inference_args.yaml \ |
| 153 | --protein_ligand_csv screening_input.csv \ |
| 154 | --esm_embeddings_path protein_embeddings.pt \ |
| 155 | --out_dir results/screening |