Skip to content

feat(viz): expand MolStar visualization for docking and structures#585

Merged
sg-s merged 9 commits into
mainfrom
molstar-viz-2
Jul 8, 2026
Merged

feat(viz): expand MolStar visualization for docking and structures#585
sg-s merged 9 commits into
mainfrom
molstar-viz-2

Conversation

@sg-s

@sg-s sg-s commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Move local work off main onto molstar-viz-2
  • Expand MolStar HTML visualization helpers and wire them through protein/ligand/docking show paths
  • Add tests, catalog notebook updates, design-doc inventory notes, and an ADR for docking box rendering without exporting Box3D

Merge-ready status

Auto-updated — cycle 7 complete, last updated: 2026-07-08T16:51:28Z

Check Status
Branch vs main ✅ synced at 19ab0d0
Head 4bcf525
CI ✅ required checks green
Copilot ✅ reviewed latest push, 0 open threads
Review threads 0 human/Bugbot, 0 Copilot
Human review ⏳ code owner approval still required

Recent activity

  • Copilot re-reviewed 4bcf525 with no new comments.
  • All Copilot nits from cycles 1–7 addressed across 7 fix commits.
  • Ready for human code owner review/merge (pending Client developers approval).

Test plan

  • uv run ruff format . && uv run ruff check --select I . --fix
  • uv run pytest --env local -x -k molstar
  • Spot-check protein/ligand/docking show() paths render expected MolStar views
  • Confirm catalog notebook cell changes look correct

Add MolStar HTML helpers and surface them on protein/ligand/docking show paths, with tests, catalog notebook updates, and design/ADR notes.
Encode fixture via read_text so base64 matches Path.read_text newline
translation used by render_ligand_html.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the in-client hosted Mol* (molstarLib) HTML visualization builders and wires them through the protein/ligand/docking notebook “show” entry points, reducing reliance on the legacy deeporigin-molstar package while documenting the remaining gaps (multi-molecule SDF splitting, Box3D export).

Changes:

  • Add new Mol* HTML builders for ligand-only, protein+poses, protein+pockets+poses, docking box, and box+poses; plus JS-safe ligand payload helpers.
  • Rewire Protein.show, Ligand.show, and Docking.show_box / ConstrainedDocking.show_box to use the hosted molstarLib paths (keeping LigandSet.show on the legacy viewer).
  • Expand and update tests and docs (catalog notebook, tutorial, design-doc inventory, and a new ADR for duck-typed Box3D).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test_molstar_html.py Adds coverage for new molstarLib HTML builders, ligand payloads, script-escape behavior, and docking box geometry HTML.
tests/test_ligand_set.py Asserts LigandSet.show() remains on legacy MoleculeViewer and returns rendered HTML.
tests/test_docking.py Updates Docking.show_box() tests to mock new HTML builder functions; adds poses= overlay case.
src/viz/molstar_html.py Implements new HTML builder functions and docking-box geometry validation; changes pocket alpha default.
src/viz/init.py Re-exports new visualization helpers from molstar_html.
src/drug_discovery/structures/protein.py Reworks Protein.show() to compose new molstarLib builders for protein/pockets/poses combinations.
src/drug_discovery/structures/ligand.py Switches single-ligand rendering to hosted molstarLib; documents LigandSet.show() as legacy due to multi-mol SDF.
src/drug_discovery/docking.py Replaces legacy docking viewer usage with molstarLib HTML builders; adds optional poses= overlay support.
src/drug_discovery/docking_common.py Adds shared pose normalization + payload construction helpers for docking-family visualizations.
src/drug_discovery/constrained_docking.py Mirrors Docking.show_box() migration to molstarLib + optional poses= overlay.
docs/notebooks/clean/molstar-visualization-catalog.ipynb Updates catalog status/sections to reflect new migrations and remaining legacy pieces.
docs/dd/tutorial/docking.md Documents show_box(poses=...) and pose navigation behavior.
docs/adr/0001-docking-box-without-exported-box3d.md New ADR documenting duck-typed {min,max} box until platform exports Box3D/createBox3D.
design-docs/README.md Updates migration status table and links the new ADR.
design-docs/01-molstar-visualization-inventory.md Updates inventory phases, API mapping, and test coverage notes for new visualizations.
CONTEXT.md Adds terminology guidance for “docking search box” naming.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/drug_discovery/structures/protein.py
Comment thread src/drug_discovery/structures/protein.py Outdated
Comment thread src/drug_discovery/docking.py Outdated
Comment thread src/drug_discovery/constrained_docking.py Outdated
Comment thread src/viz/molstar_html.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Comment thread src/viz/molstar_html.py
Comment thread src/viz/molstar_html.py
Comment thread src/viz/molstar_html.py
Comment thread src/drug_discovery/structures/protein.py Outdated
Validate empty pose collections and box color at runtime, reuse the
shared pose-label helper, tighten docking-box ValueError paths, and
drop inaccurate show_box return annotations.
Avoid ModuleNotFoundError when importing ligand without the optional
tools extra; MoleculeViewer is only needed for multi-ligand sets.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Comment thread src/drug_discovery/structures/ligand.py Outdated
Comment thread src/drug_discovery/structures/ligand.py Outdated
Drop inaccurate -> str | None annotations; docstrings now match
render_html Jupyter None vs marimo mo.Html behavior.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Comment thread tests/test_docking.py
Lock in ValueError from ligand_payloads_for_viewer when poses=[].

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@sg-s sg-s merged commit f484b18 into main Jul 8, 2026
15 of 17 checks passed
@sg-s sg-s deleted the molstar-viz-2 branch July 8, 2026 17:01
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.

2 participants