How ieumseo/vdm-lookup works
Purpose and Entry Points
vdmlookup is a Python CLI for finding atomic contacts in a PDB structure, mapping them to COMBS-compatible chemical-group (CG) interactions, and scoring them against an external read-only vdM parquet database. Primary commands are implemented in src/vdmlookup/cli.py; package metadata and console entry points are defined by pyproject.toml. A separate cluster-export workflow is provided by src/vdmlookup/cluster_export.py.
Input Preparation and PDB Boundary
The lookup pipeline begins with PDB parsing and ligand normalization. src/vdmlookup/pdb_io.py owns structure I/O, while src/vdmlookup/ligand_preparation.py prepares every nonstandard HETATM ligand before contact detection. It resolves CCD definitions through src/vdmlookup/ccd.py, retrieves/cache CCD records from RCSB, and uses RDKit to add explicit ligand hydrogens. Failure to retrieve chemical definitions is a hard boundary rather than guessing chemistry.
Contact Detection via Probe
Prepared structures are passed to the external Probe binary through src/vdmlookup/probe_runner.py; its output is decoded by src/vdmlookup/probe_parser.py and normalized into contact records by src/vdmlookup/contacts.py. Probe is built separately by scripts/build_probe.sh and expected under vendor/probe/probe. This subprocess boundary isolates geometric contact detection from the Python matching pipeline.
CG Identification and Virtual Ligands
Protein CG candidates are driven by shared CG dictionaries and definitions in src/vdmlookup/cg_dicts.py and src/vdmlookup/cg_definitions.json. Ligand substructure matching is implemented in src/vdmlookup/ligand_cg.py: it applies graph templates, bond connectivity, and hydrogen-gating constraints to prepared ligands. Matching ligand fragments become virtual CG residues with canonical amino-acid-style atom naming, allowing protein and ligand candidates to enter the same downstream matcher while preserving origin and restoring original ligand identifiers in output.
Structural Context and Candidate Assembly
src/vdmlookup/structure_features.py derives residue-level structural context, including backbone and ABPLE-related features needed for context-specific scoring. Candidate construction combines Probe contacts, residue/CG identity, target filters, and CG mappings. Shared constants and geometry-facing conventions reside in src/vdmlookup/constants.py and src/vdmlookup/geometry.py. The critical boundary here is between raw atom contacts and valid (contact residue, CG residue) lookup candidates.
Cluster Matching and Scoring
src/vdmlookup/cluster_match.py reads CG- and contact-residue-specific parquet data from the user-supplied vdM database. It aligns observed candidate coordinates to stored cluster centroids using Kabsch-style geometry from src/vdmlookup/geometry.py, selects exact or nearest cluster matches, and emits RMSD/max-distance plus C-score variants. The database is not bundled or mutated; its required directory structure is an external runtime dependency.
Cluster Inspection Export
src/vdmlookup/cluster_export.py independently reads the same vdM parquet database and exports all members of a requested cluster as a multi-model PDB for PyMOL. This path uses lookup result identifiers (CG_type, contact residue name, cluster number) but does not require the original input structure or rerun matching.
Runtime and External Dependencies
The main runtime is Python with NumPy/Pandas and no ProDy dependency. Material external services are RCSB CCD download (files.rcsb.org, cached under a platform/user cache directory or VDMLOOKUP_CACHE_DIR), RDKit and gemmi for ligand preparation, the locally built Probe executable, and the externally supplied vdM parquet database. Reference-validation support is isolated in scripts/validate_against_combs.py.
Main entry points: ligand_preparation.py Ligand preparation · cluster_export.py Cluster export CLI · pdb_io.py PDB structure I/O · ligand_cg.py Ligand CG matcher
Components 20
Entry points
- Package entry points · Defines console commands and package metadata.
pyproject.toml - Lookup CLI · Orchestrates the primary lookup workflow.
src/vdmlookup/cli.py - Cluster export CLI · Exports one stored cluster as multi-model PDB.
src/vdmlookup/cluster_export.py
Structure preparation
- PDB structure I/O
src/vdmlookup/pdb_io.py - Ligand preparation · Prepares every nonstandard HETATM ligand.
src/vdmlookup/ligand_preparation.py - CCD resolution · Retrieves or caches required CCD definitions; failures stop preparation.
src/vdmlookup/ccd.py
Contact and CG pipeline
- Probe runner
src/vdmlookup/probe_runner.py - Probe output parser
src/vdmlookup/probe_parser.py - Normalized contacts
src/vdmlookup/contacts.py - CG definitions · Protein chemical-group definitions and templates.
src/vdmlookup/cg_dicts.py - Ligand CG matcher · Creates canonical virtual CG residues while retaining ligand origin.
src/vdmlookup/ligand_cg.py - Structural context · Derives backbone and ABPLE-related context.
src/vdmlookup/structure_features.py - Lookup candidates · Valid contact-residue/CG pairs filtered for database lookup.
Database matching
- Cluster matcher and scorer · Aligns candidates to centroids and emits match distances and C-scores.
src/vdmlookup/cluster_match.py - Geometry alignment
src/vdmlookup/geometry.py - Cluster multi-model PDB · PyMOL-ready cluster-member export.
External dependencies
- RCSB CCD and cache · CCD records are downloaded and cached outside the repository.
- Probe build script
scripts/build_probe.sh - Probe executable · Performs geometric atomic contact detection.
- External vdM parquet DB · User-supplied CG and contact-residue-specific cluster data.
Connections 23
- Package entry points → Lookup CLI: registers
- Package entry points → Cluster export CLI: registers
- Lookup CLI → PDB structure I/O: reads input
- PDB structure I/O → Ligand preparation: structures
- Ligand preparation → CCD resolution: resolves ligands
- CCD resolution → RCSB CCD and cache: fetches/caches
- Ligand preparation → Probe runner: prepared structure
- Probe build script → Probe executable: builds
- Probe runner → Probe executable: invokes
- Probe executable → Probe output parser: contact output
- Probe output parser → Normalized contacts: normalizes
- Ligand preparation → Ligand CG matcher: prepared ligands
- CG definitions → Ligand CG matcher: templates
- PDB structure I/O → Structural context: residue structure
- Normalized contacts → Lookup candidates: raw contacts
- Ligand CG matcher → Lookup candidates: virtual CGs
- Structural context → Lookup candidates: context
- CG definitions → Lookup candidates: protein CGs
- Lookup candidates → Cluster matcher and scorer: valid pairs
- Geometry alignment → Cluster matcher and scorer: alignment
- External vdM parquet DB → Cluster matcher and scorer: cluster parquet
- Cluster export CLI → External vdM parquet DB: reads cluster
- Cluster export CLI → Cluster multi-model PDB: exports