CommunityImagegithub.com

protein-figure-illustration

Render and compose publication-grade flat-shaded, silhouette-outlined 3D protein figures (Goodsell / ChimeraX-flat style) with per-chain continuous score ramps, semi-transparent interface zoom panels, white-silhouette context mini-maps, stacked multi-chain colorbar legends, 90-degree rotation icons, and pixel-accurate color-coded pill callouts with non-crossing leader lines. Use when the user asks to create journal-style structural biology figures (e.g., PNAS, Nature, Cell, Bloom/Veesler lab style) mapping DMS, escape, conservation, pLDDT, or per-site metrics onto protein structures.

What is protein-figure-illustration?

protein-figure-illustration is a Claude Code agent skill that render and compose publication-grade flat-shaded, silhouette-outlined 3D protein figures (Goodsell / ChimeraX-flat style) with per-chain continuous score ramps, semi-transparent interface zoom panels, white-silhouette context mini-maps, stacked multi-chain colorbar legends, 90-degree rotation icons, and pixel-accurate color-coded pill callouts with non-crossing leader lines. Use when the user asks to create journal-style structural biology figures (e.g., PNAS, Nature, Cell, Bloom/Veesler lab style) mapping DMS, escape, conservation, pLDDT, or per-site metrics onto protein structures.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/iannunesvalenca/protein-figure-illustration/tree/HEAD

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Publication Protein Figure Illustration (Flat-Silhouette Style)

Produces multi-panel, flat-shaded, silhouette-outlined structural biology figures (like Larsen et al., PNAS 2026, 10.1073/pnas.2529505123, Panels E, F, and G) using headless PyMOL (pymol-open-source-whl via uv run) and a Matplotlib vector-annotation layer that exports both 300 DPI PNG and editable SVG.

Prerequisites

  1. uv installed and on PATH.
  2. PyMOL License Notice: If .licenses/pymol_LICENSE.txt does not exist in the project root, notify the user to check the PyMOL license at https://www.pymol.org/ and create .licenses/pymol_LICENSE.txt with the notice and timestamp. Always mention PyMOL when used.
  3. A local .pdb or .cif structure file (fetch first using pdb-database or alphafold-database-fetch-and-analyze if needed), and optionally a CSV table of per-residue scores (such as DMS effects, antibody escape, conservation, or pLDDT).

Core Visual System

Read references/STYLE_GUIDE.md for the exact PyMOL settings, multi-chain color palettes, and equivalent ChimeraX .cxc commands. Summary of the visual rules:

  • Lighting: Flat, bright, shadowless (ambient = 0.94, direct = 0.16, specular = 0, ray_shadows = 0, orthoscopic = 1, depth_cue = 0).
  • Outlines: Crisp dark charcoal silhouettes (ray_trace_mode = 1, ray_trace_color = 0x242424, ray_trace_gain = 0.004, antialias = 2). Render panels between 900 px and 1200 px wide so outline thickness stays balanced at 300 DPI.
  • Per-chain white-to-hue ramps: Assign each chain its own sequential palette where neutral or tolerant values map cleanly to #FFFFFF (starting around 78% to 85% of the range) so hotspots stand out clearly.
  • Interface close-ups:
    • Background partner: Molecular surface (either opaque flat-shaded or softly translucent via two-pass compositing so silhouettes stay crisp).
    • Foreground motif: Uniform cylindrical tube (cartoon tube, cartoon_tube_radius = 0.52, cartoon_discrete_colors = 1) plus sidechain-only sticks (cartoon_side_chain_helper = 1, stick_radius = 0.16).
  • Vector overlays: Rounded color-coded pill badges (bold white sans-serif text, no border), thin 0.8 pt straight charcoal leader lines anchored to mathematically projected 3D residue centroids, bracketed grouped domain callouts, stacked horizontal multi-chain colorbar legends, 90° rotation glyphs, and white-silhouette context mini-maps with black zoom frames.

Workflow

Step 1: Inspect Structure and Score Data

Verify the structure file exists, inspect its chain IDs, residue numbering, and score range (vmin, vmax), and identify the key residues or domain interfaces to call out. Remove waters, hydrogens, and irrelevant heteroatoms unless a bound ligand or glycan is part of the figure.

Step 2: Render Panels and Project 3D Anchors

Import helpers from scripts/render_protein_panels.py in a PEP 0723 PyMOL script run via uv run:

  1. Initialize headless PyMOL (PYOPENGL_PLATFORM=osmesa, pymol.pymol_argv = ["pymol", "-cq"], pymol.finish_launching()).
  2. Load structure and verify cmd.count_atoms("all") > 0.
  3. Call apply_goodsell_flat_style(cmd) and color_chains_from_scores(cmd, obj, scores, chain_ramps, vmin, vmax).
  4. Align symmetry or principal axes cleanly (for symmetric oligomers, align the symmetry axis to +Z so Top view and Side view are exact 90-degree rotations).
  5. Render each panel as a transparent PNG (ray=1) and record projected 2D anchors with get_projected_anchors(cmd, targets, width, height) into anchors.json:
    • Full-structure views: Opaque surface with ray_trace_mode = 1.
    • Translucent pocket + opaque motif zoom: Use render_two_pass_translucent_interface(...) so the translucent surface keeps crisp silhouette outlines.
    • Context mini-map: Color bystander chains white (outline-only silhouette), keep interacting chains colored, and compute the projected zoom bounding box of the interface residues.
  6. Save a .pse session file (and optionally export a matching .cxc script with write_chimerax_cxc(...)) and call cmd.quit().

Step 3: Compose Publication Figure (PNG + Editable SVG)

Import vector helpers from scripts/compose_protein_figure.py in a Matplotlib script run via uv run:

  • draw_stacked_legend(...) for compact multi-chain horizontal colorbars.
  • draw_rotation_90(...) for clean 90-degree rotation glyphs between views.
  • load_image_in_ax(...) to place transparent renders and obtain uv_to_ax.
  • draw_pill(...) and draw_grouped_pills(...) for chain-colored rounded pill callouts and bracketed domain lists.
  • place_noncrossing_perimeter_pills(...) for automatic angular sorting around zoomed interface panels so leader lines never cross.
  • draw_zoom_box(...) to overlay the exact projected zoom rectangle onto the context mini-map.

Save both *.png (300 DPI) and *.svg (editable in Illustrator or Inkscape).

Step 4: Visual Verification and Iteration

Always open the rendered panels and the final composed PNG with read_file to check:

  • Color contrast (tolerant regions stay clean white; hotspots pop vividly).
  • Camera framing (no clipped surfaces or awkward helix-on-end angles).
  • Leader lines (zero unintended crossings; every line lands on its exact named residue and on a camera-facing, unoccluded surface atom rather than a buried back-face residue; verify z camera depth in anchors.json and audit every residue name/number against the PDB/CIF file).
  • Label spacing (no overlapping pills, headers, or terminus numbers).

Iterate on camera vectors, ramp stops, or pill coordinates until the composed figure is clean and balanced.

Related Skills