Repository navigation
OncoPrint generic-assay heatmaps: the portal's range and colours, with pivot and sort order (ONC-TT-8) - #217
Merged
Merged
Conversation
A merged row or a patient column can hold several copy-number calls. The portal counts them by kind — driver amplification, VUS amplification, driver deep deletion, VUS deep deletion, each apart (DataUtils fillGeneticTrackDatum) — and shows and sorts by the kind with the most calls: its render priorities tie for amplification and deep deletion and are missing for the driver kinds, so every comparison in selectDisplayValue comes down to the count. The cell's copy number is a driver only when that kind is. Ours OR'd every call into the cell, so it kept both glyphs, drew and sorted the amplification, and called the copy number a driver if any call was. In the warehouse 40,845 patient–gene pairs in 28 studies hold both an amplification and a deep deletion; in 563 the deletions outnumber the amplifications. Ours alone, recorded in PORTAL-PARITY: on equal counts the portal takes the first call's kind, in an order we do not have; ours takes a driver before a VUS, then an amplification. A driver call that loses on count still makes the column driver-altered for the gutter's driver %. Tests from a case table of the legacy source, written by an agent that did not see the change (test/oncoprint-cna-calls.test.ts, python/tests/test_cna_calls.py: engine, browser re-sort, drawing, Python), seen failing first; the staircase audit's D8 and D9, marked todo for this, now pass. Three planted bugs caught, and the same three by hand in Python. npm test 4256 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3ezTZRWoR5xpTndPddHAe
…ta" last, signed number key A clinical track's legend listed its values in the order they take colours (most frequent first). oncoprintjs sorts the rules it shows by localeCompare of their labels (oncoprintlegendrenderer 103-157), lists only the values the drawn columns use, and puts "No data" — the NA rule, order +Infinity — last when a drawn column has no value (oncoprintruleset 700-709). A bar track's key is green when its range is not negative, red when not positive, both when it spans 0 (getValueRangeType 866-876, legend 257-305), its ends to 2 decimals; ours was always green. One rule, clinicalLegend in lib/oncoprint-style.ts, draws both the server SVG's legend and the page's (which passes the drawn columns, so Show unaltered off drops a value only hidden columns have). A value keeps its colour; only the order changes. Ours alone: at most 8 values, "+N more". The golden SVG's legend changes accordingly (CANCER_TYPE Breast, Colon, Lung; STAGE I, II, III, IV, No data); its cells do not. Tests from a case table of the legacy source, written by an agent that did not see the change (test/oncoprint-clinical-legend.test.ts), seen failing first. Four planted bugs caught. The page legend looked at on msk_impact_2017 with SAMPLE_TYPE and SEX: Metastasis, Mixed, Primary; Female, Male; no page errors. npm test 4270 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3ezTZRWoR5xpTndPddHAe
…h pivot and sort order (ONC-TT-8) A generic-assay heatmap row was scaled to its own data, made symmetric when it spanned 0, and drawn on the generic blue-white-red ramp. The portal (OncoprintUtils getGenericAssayTrackRuleSetParams, DeltaUtils 720-749) scales every row of a profile to the min and max of all of them, widened to the profile's pivot threshold and to 0, and picks the colours by the range and the pivot: white to dark red with no negative value (light red at a pivot inside), else dark to light blue, light to dark red when the pivot is the minimum, or all four with a jump at a pivot inside; a sort order of DESC reverses the colours. assayScale (lib/oncoprint-style.ts, ported to Python) computes the range and the gradient; a track carries its own stops and colours and heatColor draws them, so the engine, the server SVG, the canvas and its legend all follow. The pivot and sort order come from genetic_profile, for a peer through its share; a pivot is stored as a float32 and read at its seven digits (0.001). rampColor puts a value on a repeated stop on the colour after it, as oncoprintjs's binary search does. Checked on cbioportal.org: chl_sccc_2023, mutational signature contributions SBS1 and SBS13 (DESC): the portal's gradient rule set holds range [0, 0.3188], colours dark red → white, stops [0, 0.3188] for both rows; buildContract on the warehouse gives the same. gbm_cptac_2021's cell type fractions (pivot 0.001, ASC): stops [0, 0.001, 0.9532], white, light red, dark red. Known, in PORTAL-PARITY: a value exactly at a pivot can take the colour on the pivot's other side, because a cell carries its value as one of 256 codes. Tests from a case table of the legacy source, written by an agent that did not see the change (test/oncoprint-assay-colours.test.ts, python/tests/test_assay_colours.py), seen failing first; the heatmaps audit's E3, E4 and E4b, todo for this, now pass. Five planted bugs caught, and four by hand in Python. npm test 4290 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q3ezTZRWoR5xpTndPddHAe
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #215 and #216. Until they merge, their commits show here too; this PR's own change is the top commit.
A generic-assay heatmap now uses the portal's range and colours, including the profile's pivot threshold and sort order (ONC-TT-8).
Case table (legacy: OncoprintUtils
getGenericAssayTrackRuleSetParams376-470, DeltaUtils 720-749, oncoprintruleset gradient)Checked on cbioportal.org
chl_sccc_2023, mutational signature contributions SBS1 and SBS13 (sort order DESC). The portal's gradient rule set holds
value_range [0, 0.3188],colors [[213,94,0],[255,255,255]]andvalue_stop_points [0, 0.3188]for both rows.buildContracton the warehouse gives the same.gbm_cptac_2021, cell type fractions (pivot 0.001, ASC): stops
[0, 0.001, 0.9532], coloured white, light red, dark red. The pivot is stored as a float32, and we read it at its seven digits.Warehouse: 34 of the 165 generic-assay profiles have a pivot, and most have a sort order: DESC for mutational signatures and methylation, ASC for cell counts and fractions.
Known, recorded in PORTAL-PARITY: a cell carries its value as one of 256 codes, so a value exactly at a pivot can take the colour on the pivot's other side. The gradient itself, through
rampColor, puts it on the light-red side, as oncoprintjs does.Tests and planted bugs
test/oncoprint-assay-colours.test.tscovers the engine, the server SVG and the canvas, andpython/tests/test_assay_colours.pycovers the Python port. They failed before the change.assay-range-without-zeroassay-pivot-ignoredassay-desc-not-reversedassay-range-per-entityramp-repeated-stop-beforenpm test: 4,290 pass. The Python unittest suite passes.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q3ezTZRWoR5xpTndPddHAe