Skip to content

Per-genome HTML/PDF report, written by detect by default - #48

Merged
hyphaltip merged 2 commits into
mainfrom
report-genome
Oct 8, 2026
Merged

hyphaltip merged 2 commits into
mainfrom
report-genome

Conversation

@hyphaltip

Copy link
Copy Markdown
Member

Summary

  • New matpredict report genome --run DIR [--pdf FILE]: one self-contained HTML report per detect run (no network or external files), printable to PDF.
    • Result first, in plain words: mating type and confidence; "Two idiomorphs found: needs review"; "No MAT locus called" with a next step; or "Not searched".
    • One card per locus: an inline-SVG gene-order figure (role, model status, strand, exons, alternate model, called-locus bracket, contig end), the idiomorph evidence and the gene table.
    • Then: what was searched, withheld candidate loci, provenance and a glossary.
  • detect writes report.html by default. Opt out with --no-html or MATPREDICT_HTML=0; --pdf adds report.pdf. A report or PDF error is logged and never fails the run.
  • Batch scripts set MATPREDICT_HTML=0: run_clade_panel.slurm, run_polish_ab.slurm, zygo_regression.py and run_holdout_benchmark.py. They use the variable rather than the flag because they may run an older frozen worktree, which would reject --no-html but ignores an unknown variable.
  • detection_report.yaml gains a run provenance block. It records sample, organism, taxid, phylum, MATPredict version, database content SHA-256, taxonomy source, genome SHA-256/contigs/length/N50, parameters and timing. The block is additive, and older reports still render. detect gains --sample and --organism.
  • WeasyPrint 69 joins the pixi environment and environment.yml. That is 25 conda packages and a 10.3 MB download, against about 300 MB for headless Chromium. No existing locked version changed. The Docker CI smoke test renders a PDF with no network. Headless Chrome is the fallback where WeasyPrint is missing.
  • Design spec: docs/superpowers/specs/2026-10-07-genome-report-and-reads-intake-design.md. Part 1 (the report) is implemented here; Part 2 (reads intake for the on-demand service) is design only.

Review

Three rounds of an independent web- and data-design review (a briefed model agent, not a person) on rendered HTML, screenshots at 1200 px and 390 px in light and dark, and PDFs from both engines.

  • Round 1: 6 P0 findings.
  • Round 2: 1 P0, which the rewrite introduced: a hidden idiomorph margin that contradicted the table below it.
  • Round 3: "high quality on screen in every case". The last print fixes were checked on the renders.

Details and the remaining limits: analysis/2026-10-07_report-design-review.md.

Test plan

  • 36 new tests (tests/report/, tests/detect/test_provenance.py):
    • every fixture renders and shows every gene;
    • escaping of hostile sample and contig names (including the @page CSS string);
    • unique element ids and SVG colours that don't depend on page CSS;
    • margin wording, sample-name fallback, contig-end side and lane packing;
    • the default, flag and environment-variable switch;
    • a report error not failing detect, and a missing PDF engine keeping the HTML.
  • Full suite on macOS: 1,097 passed. The 13 failures are identical to main on that machine (missing Linux binaries and the viz extras).
  • PDFs rendered with WeasyPrint 70 and Chrome locally; 12 repeated Chrome renders, 0 failures.
  • Docker CI build and the new offline PDF smoke test (no local Docker daemon, so this is the first check of WeasyPrint 69 in the image).
  • Render a sample of real campaign reports on the HPCC (Basidiomycota, Mucoromycota, no-call); the fixtures other than Fola 50a are synthetic.

🤖 Generated with Claude Code

hyphaltip and others added 2 commits October 7, 2026 20:07
New package MATPredict.report and `matpredict report genome --run DIR [--pdf]`: a self-contained
HTML report of one detect run (no network), printable to PDF. Result first in plain words (mating
type and confidence; two idiomorphs: needs review; no call; not searched), one card per locus with
an inline-SVG gene-order figure, idiomorph evidence and gene table, then search summary, withheld
loci, provenance and glossary. Light/dark on screen, light in print. Revised over three rounds of
an independent web/data-design review (analysis/2026-10-07_report-design-review.md).

detect writes report.html by default (--no-html or MATPREDICT_HTML=0 to opt out; batch scripts set
the variable, which older frozen worktrees ignore); --pdf adds report.pdf; a report error never
fails the run. detection_report.yaml gains a `run` provenance block (sample, organism, taxid,
version, database SHA-256, genome SHA-256/contigs/N50, parameters, timing); detect gains --sample
and --organism.

WeasyPrint 69 joins the pixi environment (25 conda packages, 10.3 MB; no existing locked version
changed) and environment.yml; the Docker CI smoke test renders a PDF offline. Headless Chrome is a
fallback where WeasyPrint is missing.

Spec: docs/superpowers/specs/2026-10-07-genome-report-and-reads-intake-design.md (Part 2, reads
intake for the service, is design only). 36 new tests; full suite unchanged apart from them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hyphaltip
hyphaltip merged commit e9060da into main Oct 8, 2026
1 check passed
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