MolBatch is an integrated toolkit for quantitative macromolecular structure comparison, batch analysis, structure search, and reproducible PyMOL/ChimeraX visualization. It turns one-off scripts into a configurable Python and command-line workflow.
- Batch discovery of
.cif,.mmcif, and.pdbfiles - Native pairwise comparison with sequence-guided Cα correspondence and Kabsch superposition
- Reference-batch ranking and all-against-all similarity matrices
- RMSD, reference/mobile-normalized TM-score, GDT-TS, GDT-HA, Cα-lDDT, sequence identity, coverage, and aligned-core statistics
- Optional US-align comparison and Foldseek database/folder search integrations
- Dual backends:
- PyMOL script generation (
.pml) - ChimeraX command generation (
.cxc)
- PyMOL script generation (
- Configuration via YAML, JSON, or TOML
- CLI subcommands for config initialization, validation, scanning, plan inspection, script generation, execution, preset listing, backend listing, and environment diagnostics
- Reference-based alignment planning
- Chain filtering, hiding, removing, and object-specific coloring
- Background color, reference surface, transparency, and image/session export controls
- Optional object labeling for presentation-style scenes
- Plugin-style Python hook support with pre-command and post-command injection
- Markdown, JSON, CSV, and normalized plan reports
- Cross-platform path handling for Windows, macOS, and Linux
- Project-ready repository layout with docs, tests, examples, and packaging files
pip install -e .For development:
python -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .[dev]
pytestCreate a starter configuration:
molbatch init-config --format yaml --out examples/demo.yamlValidate the configuration:
molbatch validate --config examples/demo.yamlScan matching inputs:
molbatch scan --config examples/demo.yamlInspect a normalized execution plan:
molbatch plan --config examples/demo.yaml --backend pymolGenerate a PyMOL script:
molbatch generate --config examples/demo.yaml --backend pymol --out out/scene.pmlGenerate a ChimeraX script:
molbatch generate --config examples/demo.yaml --backend chimerax --out out/scene.cxcRun with a local installation:
molbatch run --config examples/demo.yaml --backend pymol --out out/scene.pmlCheck local viewer availability:
molbatch doctorQuantitatively compare two structures without a config file:
molbatch compare reference.cif model.cif --chain ARank every configured structure against the reference and write JSON/CSV/Markdown reports:
molbatch analyze --config examples/demo.yamlCreate an all-against-all TM-score matrix:
molbatch matrix --config examples/demo.yaml --metric tm_scoreUse the optional high-sensitivity engines when installed:
molbatch analyze --config examples/demo.yaml --engine usalign
molbatch foldseek-search query.cif structure_db --out hits.tsv --tmp-dir .foldseek-tmpmolbatch/
├─ docs/
├─ examples/
├─ src/molbatch/
│ ├─ backends/
│ ├─ core/
│ ├─ plugins/
│ └─ utils/
└─ tests/
- Config loading normalizes YAML/JSON/TOML into a shared internal model.
- Scanning discovers files with include patterns, exclude patterns, sorting, and optional limits.
- Planning resolves a reference structure, applies presets, and assigns colors.
- Analysis performs native metrics or delegates to US-align and writes machine-readable reports.
- Search can delegate large collection queries to Foldseek.
- Backend rendering turns the plan into a PyMOL or ChimeraX script.
- Runtime execution can optionally launch an external viewer using configurable command templates.
- Hooks let users inject custom Python logic and plain backend commands before or after script generation.
nativeis dependency-contained and ideal for same or homologous protein chains. It uses a global sequence alignment to establish residue correspondence before superposition.usalignis recommended for sequence-independent alignment, nucleic acids, complexes, circular permutations, and publication-grade TM-align/US-align results.foldseek-searchis intended for fast searches across large structure collections.
See scientific methods for metric definitions, limitations, and primary references.
Available built-in presets:
comparisonligand-focuspresentationminimalpublicationscreening
List them from the CLI:
molbatch list-presets- Align many predicted structures to a reference chain
- Keep only selected core chains in the reference while showing ligand chains in every model
- Generate reproducible sessions and figures for manuscripts or slides
- Batch-prepare viewer scripts without editing commands manually
- Pre-scan large directories and archive reports for screening workflows
Apache-2.0. See LICENSE.