How pineapplek/ed2mol works
Project type and purpose
• This is a command-line, Python-based molecular-generation pipeline (“ED2Mol”) that stitches together data-processing, ML inference, fragment libraries, and docking to generate or optimize small molecules in a given binding pocket. The Generate.py script orchestrates everything via a YAML config (in configs/).
Main components of the system
a. CLI & Configuration
• Generate.py (entry point)
• configs/*.yml (denovo.yml, hitopt.yml)
b. Data & Resource Layer
• cases/ (example PDB and core SDF for testing)
• frag_lib/ (static fragment and core libraries: Cores.sdf, Frags.sdf)
c. Preprocessing & Feature Extraction
• utils/DataProcessing.py (load PDB, prepare grids/maps)
• utils/EDExtract.py (extract electron-density features)
• utils/CorePlacement.py (position core in pocket)
d. Model Inference
• models/ED_Generator.py (ED‐guided generative model)
• models/Mol_Generator.py (fragment‐extension model)
• models/EGNN_Block.py (graph neural network layers)
e. Scoring & Post-processing
• utils/Score.py (calls smina.static for docking/scoring)
• utils/Utils.py (common helpers, I/O)
f. Output
• output_dir as specified in configs/ → generated molecules, logs
Relationships & Data Flow
1) CLI reads config →
2) DataProcessing loads receptor PDB → creates grid/ED map →
3) EDExtract pulls out features → CorePlacement anchors seed core →
4) ED_Generator proposes electron-density–driven fragment candidates →
5) Mol_Generator assembles full molecules using frag_lib →
6) Score docks & ranks candidates via smina.static →
7) Utils writes final molecules to disk
Architectural patterns & design principles
• Pipeline pattern: a clear sequence of steps, each module has single responsibility
• Config-driven orchestration: Generate.py dispatches tasks based on YAML
• Modular ML inference: separate models folder for each network
• External tool integration: smina.static called as subprocess for docking
Relevant technologies & frameworks
• Python 3.8
• PyTorch 1.13.1 + PyTorch Geometric 2.3.0
• RDKit for chemistry I/O
• Biopython, cctbx for structural biology
• smina for docking
• Conda/mamba for environment management