$ show HannesStark/boltzgen
BoltzGen is a deep learning pipeline for computational protein and peptide binder design. It provides a command-line interface (boltzgen) that orchestrates a multi-step workflow: diffusion-based backbone generation, inverse folding (sequence design given structure), folding with Boltz-2, affinity prediction, analysis, and filtering/ranking of designs. The system supports diverse protocols including protein, peptide, nanobody, antibody, and small-molecule targeting, with extensive conditioning options like binding sites, disulfide bonds, cyclization, and per-residue constraints. The codebase is structured as a Python package with modular components for data parsing (YAML design specs, mmCIF/PDB), featurization, tokenization, cropping, and model layers (pairformer, attention, diffusion, inverse folding). It includes training pipelines with Hydra configuration, PyTorch Lightning, and validation splits. While primarily an application, it also contains research-grade example datasets and a Jupyter notebook for filtering, reflecting its origin in a bioRxiv publication. The architecture is well-organized but shows some technical drift (hardcoded paths, print statements, broad exception handling) and dependency on specific CUDA versions.
The LLM identified 5 files worth highlighting for reuse:
Parses BoltzGen YAML design specifications into structured Target objects. Handles diverse modalities (protein, peptide, nanobody, small molecule), binding sites, constraints, cyclization, and structure fusion. The parser is self-contained and could be reused in other protein design pipelines to convert human-readable design inputs into internal representations.
Implements the Pairformer module used in the model trunk, combining triangular multiplicative updates and attention with pair bias. This is a clean, reusable PyTorch module that can be extracted for other structure prediction or generation tasks requiring pair representation updates.
Provides loss functions for diffusion-based structure generation, including smooth LDDT loss, bond length/angle violation loss, and weighted rigid alignment. These are general-purpose losses for protein coordinate prediction and can be reused in other generative models.
Implements a post-processing filter that applies hard thresholds (RMSD, cysteine content, amino-acid bias), ranks designs by composite quality, and performs lazy-greedy diversity selection over sequence identity. The pattern is generic for any design pipeline needing to select a diverse, high-quality subset from a large pool.
Defines the DynamicFilter base class and chain-of-responsibility pattern for filtering structures by resolution, size, date, confidence, etc. This modular filtering approach is reusable in any structural biology pipeline that needs to apply multiple criteria to a set of structures.