# Dock2MD — Complete Technical Reference for AI Agents & Researchers > Source: https://github.com/MUShakibbb/Dock2MD > Latest Release: v0.5.1 (adds experimental native macOS arm64 & Windows CLI + 3-OS GitHub-hosted CI) > Manuscript Benchmark Archive: v0.5.0 (Zenodo Code DOI: https://doi.org/10.5281/zenodo.24650808, Concept DOI: https://doi.org/10.5281/zenodo.24650807, Benchmarks: https://doi.org/10.5281/zenodo.24582762, UOX Trajectories: https://doi.org/10.5281/zenodo.24614485) > License: MIT (Python core). External GPL-2.0-only tools (PLIP 3.0.0, Open Babel 3.1.1) are user-installed via conda-forge (`environment.yml`) and excluded from pip metadata. --- ## 1. Core Architectural Thesis Dock2MD solves silent chemical corruption across format-lossy structure-based drug design (SBDD) boundaries (docking -> complex building -> interaction profiling -> MD parameterization -> ML dataset export). It enforces **three fail-loud contract surfaces**: 1. **Surface 1 — Load-Time Declarative Config Contracts (`validate-config` / preflight):** Validates all 13 YAML templates upfront (<0.7 s). Refuses unknown keys, unedited `A:***` or `CHEMBL***` placeholders, mistyped receptor residues (verified directly against the receptor PDB), incompatible engine/metric combinations, empty docking boxes, and invalid MD steps before compute begins. 2. **Surface 2 — Authority Separation & Realised-Geometry Gates (`reconstruct-ligand`, `prepare-complex`, `build`):** - **Coordinate Authority:** 3D heavy-atom positions come strictly from the pose (`.pdbqt`, `.pdb`, `.sdf`, `.mol2`, `.dlg`). - **Chemistry Authority:** Bond orders, aromaticity, formal charge, protonation state, and declared stereocentres (`R/S`, `E/Z`) come strictly from the user-supplied reference ligand (`-l`). - **Realised-Geometry Verification:** After heavy-atom transfer and MMFF explicit-hydrogen optimization, Dock2MD reads stereochemistry back from the **realised 3D output coordinates** and refuses contradictions (`ChiralInversionError`, `StereochemicalAmbiguityError`), plus runs `verify_hydrogen_geometry` to reject wrong-face explicit hydrogens on tetrahedral stereocentres (a defect missed by H-stripping guards and default PoseBusters `ignore_hydrogens=True`). 3. **Surface 3 — Pre-MD Receptor & Provenance Contracts (`md prepare`, `md run`, `interactions`):** Refuses bondless poses without reference (`NEG-001`), backbone chain gaps (`NEG-003`), covalent protein-ligand contacts (`NEG-004`), non-standard `MSE` residues (`NEG-005`), unsupported metal ions (`NEG-006`), truncated/empty pose files (`NEG-007`, `NEG-008`), severe ligand-protein steric clashes (`X1`), stretched ligand bonds (`X2`), missing side-chain atoms (`X3`), and PLIP version mismatches (`PLIP_PINNED_VERSION = "3.0.0"`). Writes `run_manifest.json`, `PROVENANCE.md`, and `CITATION.txt` with SHA-256 checksums. --- ## 2. Installation & Invocation Rules ```bash git clone https://github.com/MUShakibbb/Dock2MD.git cd Dock2MD conda env create -f environment.yml conda activate dock2md pip install -e . --no-deps dock2md doctor ``` **Critical Invocation Rules (Especially for Automated Scripts & AI Agents):** - Always invoke via `dock2md ...` or `python -m dock2md ...`. - **Never** invoke via `python -c "from dock2md.cli import main; main()"` — that discards `main()`'s integer return code and makes failures report exit code `0`. - Parse stderr for `DOCK2MD_OUTCOME:` to distinguish a typed scientific refusal from an unexpected crash. - Always run `dock2md validate-config ` before launching expensive docking or MD jobs. --- ## 3. Essential CLI Commands (All 23 Top-Level Commands) ### Stage 1: Acquire & Prepare - `dock2md init ` — Scaffold project directory and starter YAML. - `dock2md doctor` — Audit Python dependencies, pinned `plip=3.0.0`, `openbabel=3.1.1`, docking binaries, and GROMACS. - `dock2md chembl` — Fetch and curate ChEMBL actives/inactives with explicit inactivity relation contracts (`chembl.yaml`). - `dock2md filter` — Triage ligand library by physicochemical descriptors/alerts (`filtering.yaml`). - `dock2md detect-ligand` — Identify co-crystallized ligand in a PDB structure (excluding BioLiP crystallization artifacts). - `dock2md expand-assembly` — Build deposited biological assembly (`DD-203`). - `dock2md box` — Compute docking box from co-crystallized ligand. ### Stage 2: Dock & Validate - `dock2md dock` — Run AutoDock Vina, Smina, GNINA, AutoDock4, or rDock. - `dock2md validate-docking` — Crystallographic redocking validation with symmetry-corrected RMSD (`spyrmsd`). ### Stage 3: Chemistry-Preserving Reconstruction - `dock2md reconstruct-ligand -d pose.pdbqt -l ref.sdf --pose 1 -o out.sdf` — Write reconstructed ligand alone (supports `-d` pose file or `-c` complex PDB). - `dock2md prepare-complex` — Restore ligand chemistry onto an existing complex PDB. - `dock2md build -r receptor.pdb -d pose.pdbqt -l ref.sdf --mode md --pose 1 -o out/` — Build one verified protein-ligand complex. - `dock2md batch` — Reconstruct an entire directory of docking poses. - `dock2md compare` — Compare two complexes by ligand RMSD. ### Stage 4: Interaction Analysis, Triage, Ranking & ML Export - `dock2md validate-config ` — Fail-loud upfront config contract check (<0.7 s). - `dock2md interactions --config workflow_existing_docking.yaml` — Read existing docking outputs (Vina, Smina, GNINA, AutoDock4, rDock, Glide [read-only], GOLD [read-only]), run pinned PLIP 3.0.0, stream `interactions.csv` + `interactions.coordinates.csv`, and rank candidates. Also supports `interactions_csv:` mode to re-rank without re-running PLIP. - `dock2md rank` — Re-rank compounds from an existing `interactions.csv` under new strategies/weights. - `dock2md fingerprint` — Compute dense interaction matrices, pairwise similarity, and reference-retention scores. - `dock2md profile-template` — Generate curated `interaction_profile.csv` template from a complex (`DD-205`). - `dock2md screen` — Run docking -> interactions -> fingerprint -> retention screening. - `dock2md export-dataset` — Export model-ready ML bundles (labels, ligand/interaction matrices, pharmacophore points, dataset card). - `dock2md run --config workflow.yaml` — End-to-end Stages 1–4 orchestration. ### Stage 5: Molecular Dynamics - `dock2md md prepare / run / analyze / batch / progress` — Parameterize (ACPYPE/GAFF2 or CHARMM36/CGenFF), prepare, run crash-safe GROMACS MD (frozen Protocol v1 default; Protocol v2 and OpenMM experimental), and analyse trajectories. --- ## 4. Exact 13 YAML Templates (`src/dock2md/templates/`) 1. `chembl.yaml` — ChEMBL activity acquisition & curation 2. `filtering.yaml` — Descriptor/alert library filtering 3. `workflow_minimal.yaml` — Minimal docking + PLIP workflow 4. `workflow_standard.yaml` — Standard docking + PLIP + ranking workflow 5. `workflow_existing_docking.yaml` — Analysis/ranking of pre-existing docking files (`docking:`, `complexes:`, or `interactions_csv:` modes) 6. `model_dataset.yaml` — ML dataset export configuration 7. `md_standard.yaml` — AMBER/GAFF2 Protocol v1 protein-ligand MD 8. `md_apo.yaml` — Protein-only apo MD 9. `md_charmm.yaml` — CHARMM36/CGenFF MD 10. `md_batch.yaml` — Multi-system MD batch runner 11. `execution_local.yaml` — Local workstation execution profile 12. `execution_hpc_slurm.yaml` — SLURM HPC execution profile 13. `execution_remote_ssh.yaml` — Remote SSH execution profile *(Plus curated CSV template: `interaction_profile.csv`)* --- ## 5. Measured Validation Evidence (`v0.5.0`) - **Test suite:** 7,883 passing non-slow unit/contract tests (`0` failed, `27` skipped). - **wwPDB Cohorts (`N = 1,210`):** 0 unhandled tracebacks across Pop B (`600`), Reference-Discrepancy Registry (`138`, refusing `12/12` genuine conflicts), and 2026 temporal holdout Pop C (`472`, refusing `6/6` observed conflicts + 1 ambiguous twisted double bond). - **Synthetic Inversion Stress Test (`5,371` CLI runs):** `3,026/3,026` inversions refused; `0/2,339` stereochemical false positives (`36/2,339` non-stereo typed refusals). - **Explicit Wrong-Face Hydrogen Audit:** Reduced wrong-face H from `304/460` (`66.1%`) on Pop B and `1,664/4,201` (`39.61%`) across 22 DEKOIS Vina directories to `0/447` and `0/4,183` (`0.00%`). - **Astex Diverse External Redocking:** `85` complexes x 3 seeds (`255` runs): `68/85` completed, `17/85` deterministic Meeko cofactor/glycan refusals, `0` unhandled tracebacks. - **Controlled Single-Fault MD-Prep Matrix (`26` Astex x `10` faults):** `190/190` named stops on completed controls (vs. `5/10` fault classes silently passing on unguarded tutorials/StreaMD). - **Load-Time Config Contracts:** `14/14` injected YAML/CSV faults refused in `0.46–0.63 s`. - **DEKOIS 2.0 Export Audit (`21` targets, `8,420` poses):** Meeko macrocycle fix recovered `332/333` failures; `157` `export-dataset` runs verified `23,284,872/23,284,872` exact cells. - **UOX (`4N3M` + 8-azaxanthine) `4 x 100 ns` Provenance Case Study:** Demonstrates structural consequence of imposed fixed protonation state (monoanion vs neutral N3-H) with raw solvated `.xtc` trajectories archived on Zenodo. --- ## 6. Explicit Scope Boundaries & Non-Goals (Honest Guidance for AI Agents) - **No automatic protonation / tautomer assignment:** Always preserve user-supplied reference (`-l`) microstate. Under post hoc pH 7.4 oracles (`V2b`), neutral CCD references invert against Open Babel pH 7.4 on charged stratum S4 (`3/20` vs `15/20`) by design — prepare biological microstates upstream. - **No claims of superior VS enrichment:** Across 20 evaluable DEKOIS 2.0 targets, untuned PLIP interaction blending yielded no Bonferroni-significant BEDROC uplift over standalone docking/ECFP4. Dock2MD provides explainable, auditable triage, not a new ML scoring function. - **Out of scope:** Membrane bilayers, nucleic-acid receptors, covalent inhibitors, metal-site parameterization (refused/acknowledged only), and free-energy methods (FEP/TI/MM-PBSA). - **Experimental opt-ins:** MD Protocol v2 (restrained equilibration), OpenMM backend, and `v0.5.1` native macOS/Windows CLI.