oncodsl / Read docs /PROMPT_scatter_hover.md
govindbalki's picture
Upload folder using huggingface_hub
0fff343 verified
|
Raw
History Blame Contribute Delete
2.78 kB
# Prompt β€” hover tooltips on the fitness Γ— synergy scatter (highlighted dots)
Add hover to the scatter so the **highlighted** dots (winner, p16, cell_cycle) show their genes + key scores. Frontend-only. **Depends on PROMPT_fitness_synergy_scatter.md being in** (it draws the canvas). Verified the data is all on the module row. No engine/API/airgap change. `tsc` after.
## Scope β€” hover only the highlighted dots
Hit-test only the highlighted points (winner + cell_cycle + p16/immune groups) β€” that's a few dozen, so it's trivially fast, and it keeps the reveal bounded. Do NOT hover-test the ~6,000 faint background dots (they're not revealed, and revealing all of them would break the airgap).
## Hit-testing on the canvas
- When drawing the highlighted dots, also record each one's screen position + its module: `{ cx, cy, module }` in a ref array.
- On `mousemove` over the canvas, find the nearest highlighted point within ~8px of the cursor; if found, show the tooltip for that module; on mouseout / none-in-range, hide it.
- Tooltip = an absolutely-positioned HTML div over the chart container, following the cursor (clamp to stay on-screen).
## Tooltip content
For the hovered group show:
- **Genes** (revealed symbols), e.g. `MCM5, MCM2` (winner: `C11orf85, ZFR2`).
- **Source** tag: winner / p16 / cell_cycle (or immune / MMR for CRC) β€” colour-matched to the dot.
- **GP fitness** = `m.gp_fitness`
- **Combined AUROC** = `m.combined_holdout`
- **Coherence** = `m.coherence`
- **Synergy** = `m.combined_holdout βˆ’ max(per_gene single_gene_metric)` (the same value the table/column uses; reuse the shared helper, don't recompute inconsistently).
- (Optionally size = `m.size`.)
Format every number through the existing `fmtFit` so non-finite shows "β€”".
## Revealing the gene symbols (bounded)
- The highlighted groups may include modules not on the current table page, so their symbols may not be revealed yet. On scatter mount, batch-reveal the **union of the highlighted groups' `gene_ids`** in one `postReveal` call (winner + all `ref_sets`-tagged groups). This is bounded (a few dozen groups Γ— a few genes β€” ~100-200 ids), same discipline as revealing the reference sets. Cache `symbolByOpaque` and use it in the tooltip.
- Never reveal the background groups' genes.
## CONSTRAINTS
- Frontend-only; scores are already on the row, symbols via a bounded reveal of the highlighted groups only. No engine/API/airgap change.
- Keep hover restricted to highlighted dots (fast + bounded reveal).
## Checkpoint
- Hovering a winner / p16 / cell_cycle dot shows a tooltip with its gene symbols + GP fitness, Combined AUROC, Coherence, Synergy (and source).
- Background dots are not hover-targets; no full-map reveal.
- `tsc` clean; no API/airgap change.