Skip to content

Add rendering, animation, and cryo-EM map tooling#1

Merged
jvogan merged 1 commit into
mainfrom
render-cryoem-boosts
Jun 8, 2026
Merged

Add rendering, animation, and cryo-EM map tooling#1
jvogan merged 1 commit into
mainfrom
render-cryoem-boosts

Conversation

@jvogan

@jvogan jvogan commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

New shipped tools and docs for structure rendering, animation, and cryo-EM maps. All stdlib-only, JSON output, graceful degradation — consistent with the existing skill.

  • chimerax_rest.py — managed ChimeraX REST renderer (GPU): launches a GUI session on an ephemeral port, polls until ready, defeats the 0-byte-PNG save race, guarantees teardown. render / spin / run.
  • pymol_agent.pyspin turntable movies (ray-traced frames → ffmpeg, cache_frames 0 guard, graceful no-ffmpeg fallback); --preset publication|illustration|soft; --color plddt.
  • add_helix_records.py — inject HELIX records into CA-only backbones so cartoons render.
  • map_info.py — MRC/CCP4 stats + sigma-based contour levels.
  • 6 new gotchas (23 total), reference recipes, ffmpeg detection in proteus_doctor.py, hardened .gitignore.

Test

  • make test — 16 tests pass (4 new).
  • Render presets, pLDDT coloring, PyMOL turntable, and the managed ChimeraX REST render verified end-to-end on real PyMOL/ChimeraX/ffmpeg.

- chimerax_rest.py: managed ChimeraX REST renderer (GPU) with 0-byte-save fix
- pymol_agent.py: turntable movies, render presets, pLDDT coloring
- add_helix_records.py: HELIX records for CA-only backbones
- map_info.py: MRC/CCP4 sigma-based contour levels
- 6 new gotchas (23 total), reference recipes, ffmpeg detection, hardened .gitignore

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jvogan jvogan merged commit b80e1f7 into main Jun 8, 2026
6 checks passed
@jvogan jvogan deleted the render-cryoem-boosts branch June 8, 2026 15:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3fd254d21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +49 to +51
if lo <= _dist(coords[i][2:], coords[i + 3][2:]) <= hi:
for k in range(i, i + 4):
is_helix[k] = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid crossing chain boundaries in helix detection

For multi-chain CA-only designs, this distance check compares residue i to i+3 even when those entries span different chains in the PDB order. If chain termini are close enough, residues on both chains get marked as one continuous helix and helix_segments() can emit a HELIX record with the start chain but an end residue from another chain, producing invalid secondary-structure annotations. Restrict the i/i+3 comparison and segment coalescing to the same chain/residue run.

Useful? React with 👍 / 👎.

Comment thread scripts/map_info.py
nx, ny, nz, mode = struct.unpack("<4i", header[:16])
nsymbt = struct.unpack("<i", header[92:96])[0]
fh.seek(1024 + nsymbt)
raw = fh.read()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid reading entire cryo-EM maps into memory

On realistic cryo-EM maps this unconditional fh.read() loads all voxel bytes before either the numpy path or the advertised stdlib sampler can run; maps can be hundreds of MB to multiple GB, so map_info.py can exhaust memory just to report contour suggestions. Stream/sample the voxel data, memory-map it, or use header statistics when available instead of materializing the full map.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant