How dauparas/ligandmpnn works
Main Components
• Command-Line Interface (CLI) Layer: Represented by the main entry points (run.py, score.py, run_examples.sh, sc_examples.sh) and shell scripts that execute various workflows.
• Input & Configuration Management: This consists of the “inputs” directory (PDB files, JSON files with residue biases/fixes), configuration scripts (openfold/config.py), and the get_model_params.sh script to download model weights.
• Data Parsing & Pipeline: Under the “openfold/data” subpackage, you have several modules handling parsing (pdb/mmcif parsing, residue indexing, template handling) and transformation logic that prepares the input for the model. Also include the “data_utils.py” at the top level.
• Model & Inference Core: Show the integration of the different MPNN models. This includes components for model loading and executing one of the available models (ligand_mpnn, protein_mpnn, soluble_mpnn, global_label_membrane_mpnn, per_residue_label_membrane_mpnn). The different checkpoints and settings (like noise level) are parameterized via the CLI.
• Side Chain Packing Module: Under “openfold/np/relax” and corresponding output directories (sc_default, sc_fixed_residues, etc.), denote the side chain packing and relaxation code that takes designed sequences and then performs structural refinement.
• Training & Testing Utilities: Include the “training” directory components which hold testing inputs and training JSON files, supporting a benchmark/validation mode.
• External Dependencies and Third Party Integrations: List external dependencies such as Prody (for PDB parsing), PyTorch and Numpy, and the use of parts of the Openfold code (for side chain packing and protein structure abstractions).
Relationships and Interactions
• User Interaction begins at the CLI where command line arguments determine which modules are activated (e.g., whether to run inference, design with fixed residues, apply ligand context for packing, etc.).
• The CLI then forwards the settings to the Input Processing/Parser that reads PDB files and any bias/fix JSONs.
• The Data Pipeline processes these inputs (via modules in openfold/data/) and outputs processed features (including residue indices and chain information) for the deep learning models.
• The Inference Core loads the selected model checkpoint and runs predictions based on the input features, generating sequence logits, probabilities, and design confidences.
• If side chain packing is enabled, the system invokes the side chain relaxation module that adjusts the atomic context based on ligand/dna inputs.
• Finally, results (designed sequences, packed PDB files, fasta outputs, and optional scoring statistics) are written out to the appropriate directories in “outputs/”.
Important Architectural Patterns
• Modularity: The system splits responsibilities among clear modules – parsing, data transformation, modeling, and output generation.
• Extensibility: The design allows for plug-and-play of different MPNN variants along with customizable options (fixed residues, redesigned residues, biases per residue, etc.).
• Dependency Injection: Configuration options (via CLI flags) dynamically determine which components are active and how they interact.
Relevant Technologies
• Python (with packages PyTorch, NumPy, Prody).
• Shell scripting for model parameter downloads.
• JSON-based configurations for biasing/fixing residues.
• Openfold library modules for structural operations (PDB parsing, side chain packing).