Skip to content

Write an HTML report with a Mol* view (--no-report to turn it off) - #49

Merged
amjjbonvin merged 9 commits into
mainfrom
46-report
Nov 6, 2026
Merged

amjjbonvin merged 9 commits into
mainfrom
46-report

Conversation

@amjjbonvin

@amjjbonvin amjjbonvin commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

What does this PR do and why?

Adds an HTML report, so the CSB portal can show DisVis results with a Mol* view, as it does for PowerFit, and drop the Chimera images (#46).

DisVis now writes report.html and state.mvsj (MolViewSpec, Mol* 5.13.1 mvs-stories from jsDelivr, as in powerfit_em/report.py) in the output directory, and copies the input files there (the report shows the fixed chain and links all of them); --no-report turns this off. disvis.log and the terminal end with how to view the report. The report shows what the portal's results page shows now:

  • accessible complexes per number of consistent restraints (N);
  • violations per restraint, without the all-zero rows;
  • z-scores, labelled with the restraints (e.g. A27(CA)-A18(CA)), z ≥ 1 highlighted;
  • with -is, for each N the 10 most contacted receptor and ligand residues (most first), and the full interaction tables, colored from white to green (most contacted);
  • a Mol* view of the fixed chain with accessible_interaction_space.mrc for each N and, with -oa, occupancy_N.mrc (green); with -is, the selected residues of the fixed chain are colored from white to red by their average number of interactions per complex.

The tables (except the lists of most contacted residues) sort by a column when its header is clicked (▲/▼ on the sorted column). All files are referred to by relative names. The report is built from the output files, which are unchanged. New dependency: molviewspec.

disvis.log now starts with a header giving the DisVis version.

Each example-results directory has its report (generated from the existing reference files). New reference run PRE5-PUP2-complex/example-results/cpu/coarse-is-oa (-is selection.res -oa), to show the occupancy maps and interaction analysis; its other output files are identical to cpu/coarse.

How was this tested?

  • New unit test (tests/test_report.py): generate_report on the text output of a small -is -oa run (tests/data/output); checks one snapshot per N, relative URLs only, the restraint labels and interaction tables. All 27 unit tests pass (-W error), also in the Pyodide wheel (local cibuildwheel).
  • test-cases/check_test_cases.py (coarse, now with the report): output files byte-identical to the references.
  • Reports checked in headless Chrome over HTTP (PRE5-PUP2 coarse-is-oa, RNA polymerase II fine). The residue colors are not checked by the unit test.

Not tested: the portal embedding. Opened from disk (file://), the browser blocks the files of the viewer; the page then says to serve the directory with python -m http.server.

AI assistance

Written with Claude Code; checked as above.

Checklist

  • Tests cover the new and/or changed code
  • Documentation updated if needed (README.md, INSTALLATION.md)
  • Reference results in test-cases/*/example-results/ updated if the output changes (output unchanged; reports and the coarse-is-oa run added)

Related issues

Closes #46

Notes for reviewers

  • The issue mentions accessible_interaction_space_<N>.mrc; DisVis writes a single map whose value is the number of consistent restraints, so the report shows it at level N − 0.5 for each N (Chimera in the portal uses level N).
  • Occupancy maps are shown at 2 sigma, in green over the grey interaction space; the view is centered on the fixed chain (Mol* would otherwise fit the whole map grid). Colours and levels are open for suggestions.
  • molviewspec 1.8 raises a pydantic deprecation warning on import, hidden in normal runs; the test ignores it (the unit tests run with -W error).

🤖 Generated with Claude Code

amjjbonvin and others added 2 commits November 2, 2026 20:35
--report writes report.html and state.mvsj (MolViewSpec, as in
PowerFit) in the output directory: the accessible complexes,
violations, z-scores with the restraint labels, the interaction tables
with -is, and a Mol* view of the fixed chain with the accessible
interaction space for each number of consistent restraints, plus the
occupancy grids with -oa. Files are referred to by relative names.
The report is built from the output files, which do not change.

The test cases run with --report, and each reference directory has its
report.

Closes #46

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- With -is, the report colors the selected residues of the fixed chain
  from white to red by their average number of interactions per
  complex; occupancy maps are green. The view is centered on the fixed
  chain instead of the whole map grid.
- disvis.log starts with a header giving the DisVis version.
- New reference run PRE5-PUP2 cpu/coarse-is-oa (-is -oa --report), with
  occupancy grids and interaction tables; its other output files are
  identical to cpu/coarse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- report.html is written by default; --no-report turns it off.
- With -is, the report lists the 10 most contacted receptor and ligand
  residues for each N.
- The tables sort by a column on a click on its header.
- tests/test_report.py closes disvis.log, which Windows cannot remove
  while it is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amjjbonvin amjjbonvin changed the title Add a --report option (HTML report with a Mol* view) Write an HTML report with a Mol* view (--no-report to turn it off) Nov 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amjjbonvin
amjjbonvin marked this pull request as ready for review November 3, 2026 08:07
@amjjbonvin
amjjbonvin requested a review from a team as a code owner November 3, 2026 08:07
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Read the interaction files once, with helpers.parse_interactions.
- Skip comments in the restraints file as parse_restraints does.
- main() closes disvis.log before writing the footer; the test no longer
  needs logging.shutdown().
- The molviewspec warning filter moves from report.py to the test: the
  warning only shows with -W error.
- No color nodes for residues without interactions (white is the base).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amjjbonvin amjjbonvin self-assigned this Nov 3, 2026
@amjjbonvin amjjbonvin added the UX improve the usability of the tool / user experience label Nov 3, 2026

@sverhoeven sverhoeven 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.

Works for me.
I was able to generate the report and use --no-report

Regarding inline comments.
There are 3 requests for changes: README.md, slow test and http server log.
The other comments are suggestions.

Btw congrats on https://pypi.org/project/disvis/

Comment thread README.md Resolved
Comment thread src/disvis/main.py Resolved
Comment thread src/disvis/main.py Resolved
Comment thread src/disvis/report.py Resolved
Comment thread src/disvis/report.py Resolved
Comment thread src/disvis/report.py Resolved
Comment thread src/disvis/report.py Resolved
Comment thread src/disvis/report.py Resolved
Comment thread tests/test_report.py Resolved
- README: no single options listed (--help does).
- The http.server hint is also printed to the terminal.
- The accessible complexes table starts with the most restraints, as the
  snapshots.
- Mol* 5.13.1.
- The sorted column shows ▲ or ▼.
- The ligand, restraints and selection files are copied to the output
  directory and linked for download.
- The test calls generate_report on stored text output (tests/data/output),
  without mocking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amjjbonvin
amjjbonvin requested a review from sverhoeven November 5, 2026 19:48
amjjbonvin added a commit to haddocking/whiscy that referenced this pull request Nov 6, 2026
… structure (#72)

* Report: sort arrows, how-to-view hint in the terminal, link the input structure

From the review of the DisVis report (haddocking/disvis#49):
- show ▲/▼ on the sorted column of the residue table (Rank ▲ on load);
- end whiscy_haddock with how to view report.html (python -m http.server),
  in the terminal and whiscy.log, with the relative path;
- link the input structure in the report, copied next to it when it is not
  in the current directory (a different file of the same name is kept).

Closes #65

* Prepare the v1.6.1 release (CHANGELOG, version)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- README.md: a "Viewing the report" section (python -m http.server), and
  the disvis.log header and footer.
- CHANGELOG.md: the disvis.log header and footer.
- Regenerated disvis.log of all reference runs, with the version header and
  the report footer (CPU on the Apple M2 Pro, GPU on the RTX 6000 Ada); the
  other output files are byte-identical.
- test-cases/README.md: run times of these runs for the M2 Pro -p 8 and
  RTX 6000 Ada rows, and the notes that depend on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@amjjbonvin
amjjbonvin merged commit 2d19cf7 into main Nov 6, 2026
26 checks passed
@amjjbonvin
amjjbonvin deleted the 46-report branch November 6, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI enhancement UX improve the usability of the tool / user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a --report option (HTML report with a Mol* view), as in PowerFit

2 participants