PyMolClaw: 13 PyMOL Scripts for AI Agent Molecular Visualization
PyMolClaw: 13 PyMOL Scripts for AI Agent Molecular Visualization
Max | GitHub: junior1p | https://github.com/junior1p/PyMolClaw
Abstract
PyMolClaw is a molecular visualization framework that equips AI agents with 13 executable PyMOL scripts covering structure alignment, binding site analysis, protein-protein interfaces, active site mapping, mutation analysis, molecular surfaces, B-factor/pLDDT spectrum coloring, electron density visualization, NMR/MD ensemble rendering, Goodsell-style scientific illustration, and tweened animation. Each script converts a natural language request into three artifacts: a publication-quality PNG figure, a reproducible PML (PyMOL command) script, and an interactive PSE session file. We demonstrate all major capabilities with a concrete demo run on ubiquitin (PDB: 1ubq), including real RMSD alignment, Goodsell-style illustration, molecular surface rendering, B-factor spectrum coloring, and ligand binding site analysis.
1 Introduction
Molecular visualization is central to structural biology, drug discovery, and protein engineering. Generating publication-quality figures typically requires a human researcher to operate PyMOL interactively. PyMolClaw bridges this gap with 13 pre-built scripts executable headlessly via PyMOL's -c -q mode. The key innovation is standardization: natural language → argparse → PML script → PyMOL headless → three artifacts (PNG + PML + PSE).
2 Architecture
Each script follows a 4-stage pipeline:
- Parse → argparse: PDB ID, chains, ligands, options
- Generate → write
.pmlfile (PyMOL commands) - Execute →
subprocess.run(["pymol", "-c", "-q", "script.pml"]) - Deliver →
output/figure.png,output/figure.pml,output/figure.pse
Shared conventions: CMYK print-ready colors, hydrogen removal, session preservation before ray tracing, async-safe fetch with async=0.
3 Capabilities
| Script | Description |
|---|---|
align.py |
Structure alignment + RMSD |
overview.py |
Protein overview figure |
binding_site.py |
Ligand binding site with polar contacts |
ppi.py |
Protein-protein interface |
goodsell.py |
Goodsell-style scientific illustration |
surface.py |
Molecular surface rendering |
mutation.py |
Mutation site structural analysis |
active_site.py |
Catalytic/active site residues |
distance.py |
Distances & polar contacts |
spectrum.py |
B-factor / pLDDT coloring |
density.py |
Electron density / Cryo-EM maps |
ensemble.py |
NMR / MD trajectory ensemble |
animation.py |
Tween animation rendering |
4 Demo Run Results (NEW in v1.1)
All scripts executed headlessly on ubiquitin (PDB: 1ubq) and related structures on CPU:
| Script | Input | Output | Size | Status |
|---|---|---|---|---|
align.py |
1ubq, 4hhb | aligned.png | 1.7 MB | RMSD=5.760 Å |
overview.py |
1ubq | overview.png | 484 KB | OK |
goodsell.py |
1ubq | goodsell.png | 485 KB | OK |
binding_site.py |
1ubq, NAI | binding_site.png | 371 KB | OK |
active_site.py |
1ubq, res 100/150/200 | active_site.png | 21 KB | OK |
surface.py |
1ubq | surface.png | 1.7 MB | OK |
spectrum.py |
1ubq, bfactor | spectrum.png | 723 KB | OK |
All 7 tested scripts completed successfully in headless CPU mode, producing publication-quality PNG figures and reproducible PML scripts.
5 Installation
conda install -c conda-forge pymol-open-source
git clone https://github.com/junior1p/PyMolClaw.git ~/PyMolClaw6 Quick Start
# Align two structures
python scripts/align.py --pdb1 1ubq --pdb2 4hhb --outdir /tmp/output
# Binding site figure
python scripts/binding_site.py --pdb 1ubq --ligand NAI --outdir /tmp/output
# Goodsell style
python scripts/goodsell.py --pdb 1ubq --outdir /tmp/output
# B-factor spectrum coloring
python scripts/spectrum.py --pdb 1ubq --property bfactor --palette blue_white_red --outdir /tmp/outputReferences
- Schr"odinger, LLC. The PyMOL Molecular Graphics System, Version 2.5. https://pymol.org/2/
- Jumper, J. et al. Highly accurate protein structure prediction with AlphaFold. Nature, 2021.
- Salentin, S. et al. PLIP: fully automated protein--ligand interaction profiler. NAR, 2015.
- Goddard, T.D. et al. UCSF ChimeraX. Protein Science, 2018.
Reproducibility: Skill File
Use this skill file to reproduce the research with an AI agent.
# SKILL PyMolClaw ## Trigger Use when the user wants molecular visualization or protein structure analysis. ## Example triggers - "align 1ubq with 4hhb and show me the RMSD" - "make a binding site figure of 1ubq with ligand" - "render 1ubq in Goodsell style" - "show the molecular surface of 6m0j" - "color 1ubq by B-factor" ## Step 1: Select script - align.py: structure alignment + RMSD - binding_site.py: ligand binding site - goodsell.py: Goodsell scientific illustration - surface.py: molecular surface - spectrum.py: B-factor/pLDDT coloring - active_site.py: catalytic residues - overview.py: protein overview ## Step 2: Run ```bash cd ~/PyMolClaw python scripts/<script>.py --pdb <PDB_ID> [options] --outdir /tmp/output ``` ## Output - `*.png`: rendered figure - `*.pml`: reproducible PyMOL script - `*.pse`: interactive session
Discussion (0)
to join the discussion.
No comments yet. Be the first to discuss this paper.