Repository navigation
Study View: a density drag adds its ranges to the bar charts as custom bins (STS-SC-6) - #449
Conversation
…m bins (STS-SC-6) As the portal's _customBinsFromScatterPlotSelectionSet: dragging a box on the Mutation Count vs FGA density sets the two range filters and adds each range's ends to that attribute's bar chart as custom edges, so the selection is drawn as bars of its own. Shares the pill edit's rule (addBinEdges, binsAfterEdit). Verified on coadread: a drag over the populated corner, FGA [0, 0.38], Mutation Count [271, 5684], 74 patients; the bars gain (240, 271], (271, 5,684], >5,684 and (0.35, 0.38], (0.38, 0.4]. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
# Conflicts: # app/lab/page.tsx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review verdict: changes requested The wiring is right: a drag adds each range's two ends to the Mutation Count and FGA bars, both edits accumulate correctly through Blocking
Non-blocking (nit)
CI: |
…der's Custom Bins Review of #449. As the portal's _customBinsFromScatterPlotSelectionSet: a drag's edges are kept for the page only (a ref), each drag replaces them, and they apply only while the draft holds that drag's range (withDensityBins), so removing the filter, Clear All or a selection on the bars drops them. Nothing is written to the reader's Custom Bins, so they no longer pile up, survive a reload, or keep Log Scale hidden. Verified on coadread: a drag adds (240, 271], (271, 5,684] to Mutation Count; browser storage holds no bins; Clear All restores the default bars. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
|
Fixed in 26998c0. Blocking
Nit
Unit tests cover the set: applied while held; dropped when removed, cleared or replaced; the reader's bins unchanged. A planted bug (edges outliving the filter) is guarded by them. |
The generic constraint { bins?: unknown } is a weak type, so the test's
reader bins ({ showNa }) failed tsc on the test file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
| * The edges a drag box's ranges add to their attributes' bar charts, as the portal adds them as | ||
| * custom bins (STS-SC-6, _customBinsFromScatterPlotSelectionSet): each range's two ends. | ||
| */ | ||
| export interface DensityBins { attribute: string; range: { gte: number; lte: number }; edges: number[] } |
There was a problem hiding this comment.
nit: DensityBins and withDensityBins were inserted between densityBinEdges and its JSDoc ("The edges a drag box's ranges add…: each range's two ends"), so that comment now documents the DensityBins interface. Move the comment down to densityBinEdges.
| * these clauses only mean what they mean together. | ||
| */ | ||
| /** a numeric chart's bars, plus these edges as custom bins, so a range filtered on is drawn as its own bars (STV-FB-4, STS-SC-6) */ | ||
| const addBinEdges = (attribute: string, ends: number[]) => { |
There was a problem hiding this comment.
nit: still open from the last round. addClauses's JSDoc ("Deliberately plainer than addClause…") sits above addBinEdges, with addDensitySelection between them and addClauses itself. Moving addBinEdges/addDensitySelection above that comment, or below addClauses, puts it back on its function.
|
Re-review verdict: pass (26998c0, 5539663) Both earlier blocking findings are fixed.
Non-blocking
CI: no failures. gate-local, gate-e2e, gate-warehouse and lint were still pending at review time; reports, coverage and Vercel were green. |
Summary
Dragging a box on the Mutation Count vs FGA density chart now adds each range's ends to that attribute's bar chart as custom edges, as well as setting the two range filters. The selection then reads as bars of its own, as on the portal (
_customBinsFromScatterPlotSelectionSet, STS-SC-6).densityBinEdgesinlib/study-view-density.ts: each range's two ends._customBinsFromScatterPlotSelectionSetis a set of its own (legacy-spec 30-study-summary.md STS-SC-6, STS-BAR-5):withDensityBins, laid over the reader's bins when Explore is asked). Removing the filter, Clear All Filters, or a selection on the bars, which replaces the chart's filter, drops them.Spec IDs
Verification
test/study-view-density-spec.test.ts: a drag's ranges give each attribute its two ends, and on Mutation Count's bars those join the bars' own edges; the edges apply while the draft holds the drag's range, and not once it is removed, cleared or replaced; the reader's bins are not changed.npm test6,811 pass, 0 fail.scripts/mutants/study-view/density-bins.ts(guardunit), one of them edges that outlive the filter.Tracker
Under "Study View → summary charts", this line (docs/PORTAL-PARITY.md:409) is ticked:
Scorecard
30-study-summary.md, row STS-SC-6 (was| STS-SC-6 | 🟡 | C | Drag a box → two range clauses (MC rounded to whole counts, FGA by span) (\explore-charts.tsx:89-92`); no custom bins added to the bar charts |`):| STS-SC-6 | ✅ | C | Drag a box → two range clauses (MC rounded to whole counts, FGA by span), and their ends added to the two bar charts as a temporary set of edges while the filters hold (
withDensityBins) |Preview
/lab?tab=explore&study=coadread_tcga_pan_can_atlas_2018: drag a box on the density chart's lower-left corner, then look at the Mutation Count and FGA bars.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht