Skip to content

Add MSK-TARGET RNA similarity maps, patient-view map and expression coloring - #5678

Open
inodb wants to merge 37 commits into
cBioPortal:masterfrom
inodb:target-rna-umap
Open

inodb wants to merge 37 commits into
cBioPortal:masterfrom
inodb:target-rna-umap

Conversation

@inodb

@inodb inodb commented Aug 17, 2026 •

Copy link
Copy Markdown
Member

Adds the MSK-TARGET RNA-seq cohort to the Similarity Maps tab, brings the tab to the
patient view, and makes the maps legible at cohort sizes far smaller than the
50K-point map they were built for.

Which maps exist, and when the tab shows

A manifest in embeddingSources declares which studies each map covers. The tab is
hidden for studies no map covers, decided from the manifest alone — so it costs no
fetch, and a study no map covers no longer pulls several MB to discover that.

The manifest is hardcoded because a map only names its studies inside the file itself.
Replace it with an API call once one exists; nothing outside that module depends on
where the list comes from.

The EMBEDDINGS feature flag now gates individual maps rather than the tab, so one
map can ship on by default while another stays opt-in.

Patient view

A Similarity Map tab shows where the patient's samples sit on any loaded map. It appears
once a map holds one of them, or immediately when deep-linked so the link doesn't fall
back to Summary meanwhile.

Coloring and legend

  • Expression coloring. Selecting a gene previously coloured only by mutation, CNA and
    structural variant. An Expression checkbox now colours continuously from the study's
    mRNA profile, reusing the ramp and colourbar of numeric clinical attributes. It is
    mutually exclusive with the alteration colourings in both directions, since one is
    continuous and the others categorical.
  • Log scale is live for expression, where it matters because TPM spans orders of
    magnitude, and withheld for profiles with negative values such as z-scores.
  • Default coloring moves to CANCER_TYPE. CANCER_TYPE_DETAILED reaches ~90 categories
    on these cohorts, which exhausts the palette and leaves the legend unreadable.
  • Legend row actions are overlaid rather than swapping out the count, so the row no
    longer reflows on hover.
  • Samples the portal does not hold are coloured from the embedding's referenceData.

Point sizing

The maps were tuned for 50K points and rendered a ~1K-point map as sparse specks. Point
size now derives from the median nearest-neighbour spacing and the point count, so a
1K-sample map reads like a 50K one. Out-of-cohort points keep a fixed size whether hidden
or shown, so toggling them no longer resizes the plot.

Fixes

  • The gradient legend built its SVG element id by replacing only whitespace, so a label
    containing parentheses — e.g. a clinical attribute like TMB (nonsynonymous) — closed
    the url(#...) reference early and the colourbar rendered solid black.
  • The coloring menu and the plot toolbar were both z-index: 1, and the toolbar comes
    later in the DOM, so it covered the gene options. The menu is now portalled to body.

Tests

Unit tests for the expression-coloring transform, the patient-view map's sample matching
and the point-sizing utilities; the existing legend hover test is updated for the
overlaid row actions, and the embeddings reference screenshots are refreshed for the
coloring and sizing changes. No new e2e tests.

Preview

The Mosaic map is behind the EMBEDDINGS flag, so append &featureFlags=EMBEDDINGS to a
study view that it covers. The MSK-TARGET map's data is not served from the public CDN
and so does not load here; reviewing it needs an MSK deployment.


🤖 Generated with Claude Code

https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j

Copilot AI lite review requested due to automatic review settings August 17, 2026 18:55
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@inodb is attempting to deploy a commit to the Human Tumor Atlas Network Team on Vercel.

A member of the Team first needs to authorize it.

@inodb inodb changed the title Add MSK-TARGET RNA UMAP to the Similarity Maps tab Add RNA UMAP to the Similarity Maps tab Aug 17, 2026
@netlify

netlify Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cbioportalfrontend ready!

Name Link
🔨 Latest commit dc80242
🔍 Latest deploy log https://app.netlify.com/projects/cbioportalfrontend/deploys/6b048d928ce573acb577a03b
😎 Deploy Preview https://deploy-preview-5678.preview.cbioportal.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI 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.

Pull request overview

Adds an MSK-internal MSK-TARGET RNA UMAP embedding to the Study View “Similarity Maps” tab, alongside the existing H&E embedding, with a user-facing hint when the MSK-internal resource can’t be reached.

Changes:

  • Introduces a new remoteData loader for the MSK-TARGET RNA UMAP JSON (MSK-internal only).
  • Registers the new embedding as a selectable option when the embedding data is available.
  • Expands loading/unavailable UI logic to account for the new embedding and show an MSK-VPN hint on failure (scoped to msktarget).
Suppressed comments (3)

src/pages/studyView/tabs/EmbeddingsTab.tsx:524

  • msktargetRnaData.isPending access will trigger the MSK-TARGET loader on first render for any study (on MSK portal), even though the option is only relevant for msktarget. Gate the pending check on the current study to avoid an unnecessary network request and large JSON parse.
    @computed get isEmbeddingDataLoading(): boolean {
        return boehmHeData.isPending || msktargetRnaData.isPending;
    }

src/pages/studyView/tabs/EmbeddingsTab.tsx:534

  • isTargetRnaEmbeddingUnreachable currently reads msktargetRnaData.isError first, which triggers the loader even when the user is not viewing msktarget. Flip the order so the study check short-circuits before touching the MobxPromise state.
    @computed get isTargetRnaEmbeddingUnreachable(): boolean {
        return (
            msktargetRnaData.isError &&
            this.currentStudyIds.includes(MSKTARGET_STUDY_ID)
        );

src/pages/studyView/tabs/EmbeddingsTab.tsx:1083

  • This pending check also triggers the MSK-TARGET RNA loader for non-msktarget studies whenever plotComponent is evaluated. To keep the RNA embedding lazy (and only load when relevant), gate it on currentStudyIds here as well.
    @computed get isLoading(): boolean {
        // Check if embedding data is still loading
        if (boehmHeData.isPending || msktargetRnaData.isPending) {
            return true;
        }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +71 to +83
const msktargetRnaData = remoteData<EmbeddingData | null>({
await: () => [], // No dependencies - invoke once immediately and cache
invoke: async () => {
if (!isMskInternalPortal()) {
return null;
}
const response = await fetch(TARGET_RNA_EMBEDDING_URL);
if (!response.ok) {
throw new Error('Failed to load MSK-TARGET RNA embedding data');
}
return response.json();
},
});
Comment on lines +493 to +499
if (msktargetRnaData.isComplete && msktargetRnaData.result) {
options.push({
value: 'msktarget_rna_umap',
label: msktargetRnaData.result.title,
data: msktargetRnaData.result,
});
}
@dippindots
dippindots marked this pull request as draft August 17, 2026 19:29
@inodb inodb added the cl-prototype Prototype section in changelog. New features not ready for production use label Aug 17, 2026
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cbioportal-frontend Ready Ready Preview Nov 23, 2026 7:05pm UTC

Request Review

@inodb inodb changed the title Add RNA UMAP to the Similarity Maps tab Add MSK-TARGET RNA similarity maps, patient-view map and expression coloring Nov 12, 2026
@inodb
inodb marked this pull request as ready for review November 13, 2026 00:34
Colouring by a gene and colouring by a clinical attribute wait on
different things, and when the gene path was added the attribute path
stopped being waited on at all: the cover came down as soon as the
sample list landed, showing the grey map it exists to hide, and the
colours followed a few seconds later.

It waits on the clinical cache entry again, on !isComplete rather than
isPending, because an entry that has not been asked for yet is neither,
and that gap is wide enough to show.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
The plot sizes its points in data units, so they grow as the map is
zoomed into, while the icon marking this patient's sample was a fixed
eighteen pixels: the closer you looked, the smaller it read against its
neighbours.

It now scales by the same factor deck applies to the points, from the
zoom that frames the whole map, between its old size and six times it -
eighteen to seventy-two pixels. The floor keeps it findable zoomed out,
where the points are specks; the ceiling keeps it from covering the
neighbourhood it is meant to sit in.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
The patient view rendered its own map beside the study view's, and the
two drifted: every fault found this week - points recoloured on every
frame, a control that overflowed its panel, a map left grey while its
colours loaded - was in the copy, not in the original. It now renders
that same tab over the studies its map covers, and gets panels, map and
viewport locking, tooltip fields and the gradient editor with it.

Two things had to give way first.

Under the dev server the map came up blank: deck assembled a layer's
shader from one copy of the GL stack and injected the filter hook from
another, and it would not link. Each page there is its own lazily loaded
chunk and node_modules are shared for initial chunks only, so the
patient page picked up a second copy when it began importing study view
modules. The GL packages now resolve to one shared chunk. The production
build already resolved them once by itself - built with and without this
change, deck.gl appears in main.app.js and nowhere else either way - so
the group emits no chunk there and this is for the dev server's sake.

Panel count then rendered but did nothing, because setting it returned
early without a urlWrapper. The count is the tab's own state; the URL is
where a page that has one keeps it.

This patient's samples are marked through a renderOverlay the viewer
offers, which every panel receives along with the embedding it is
showing, since panels need not show the same map and a sample sits
somewhere different in each. The marks size themselves from the
projection, so they grow with the points as a panel is zoomed in rather
than shrinking against them.

Verified with two panels: one mark per panel, each within its own
canvas. The map is never drawn uncoloured - sampling the canvas while it
loads, it holds no points until its colours are in. The study view is
unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
Switching the patient map to the study view's tab lost the handoff that
page was built around: a lasso there became a cohort filter, which a page
with no cohort cannot apply, so a neighbourhood picked on the map had
nowhere to go.

The tab now takes a renderSelectionActions slot beside Clear, handed the
samples the first panel's selection covers and the map it is showing. The
patient view fills it with the link it had before - this patient's samples
when nothing is selected, the selection when something is. The samples
carry their own study, so the multi-study map needs no second lookup for
what each point belongs to.

Make Global is drawn only where a selection can become a cohort filter.
It rendered on the patient map and did nothing.

A pinned tooltip takes clicks, so its Patient ID and Sample ID are links
to those pages. Points carry the study their sample belongs to, which a
map spanning thirty studies needs to name the right one; out-of-cohort
points have none and stay plain text, as does an unpinned tooltip, which
the cursor would never let you reach.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
inodb and others added 2 commits November 18, 2026 14:06
Rendering the study view's tab left most of this page unreachable: its
colour-by menu, legend, viewport, point building and lasso resolution were
all the tab's job now, and nothing called them. They are gone, along with
the three utilities only they used, taking the page from 889 lines to 260.

Removing them exposed two faults in the panel that the patient page had
been hiding by fetching clinical attributes before the map mounted.

The panel settles on a default colouring at mount and, if the attribute it
wants is not there, falls back to "None". It asked an attribute list that
is never empty - a synthetic "Cancer Study" entry is always prepended - so
the fetch had no say, and the fallback stuck. It now asks the fetch, and
the reaction that revisits the choice no longer requires a urlWrapper: the
URL is where a page that has one keeps the choice, not where the choice is
made. It still only applies while nothing is chosen, so a later attribute
cannot undo a selection.

"None" then hung the map. It carries entrez id -10000, and three places
treated anything but -3 as a gene, so the panel awaited alteration data
for it: thirty studies' copy number, rate limited into failure, waited on
for ever behind a spinner. They now use selectedEntrezGeneId, which has
excluded both sentinels all along.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
A lasso merged into one anonymous set that could only be cleared whole, so
two neighbourhoods could not be held at once, let alone contrasted - the
thing a map like this is for.

Each draw now makes a selection of its own, listed beside the map with its
count and a colour it keeps everywhere: as a ring on its points, as a chip
you can remove on its own, and as its group's colour in comparison. Select
stays armed between draws, since several selections are the point.

Compare opens them in group comparison, one group per selection, named and
coloured as their chips are. It needs two, so the button says so until
there are. Highlight and Filter still act on everything selected, and on
the study view Make Global still applies that union as a cohort filter.

Backdrop points from outside the cohort are pickable but have no sample
behind them on this page, so they are left out of a selection: a chip's
count is now what a comparison or a filter would actually contain.

The study view's link also stopped carrying selections it could not. A
lasso of 15,000 samples encodes to 1.4 MB of URL, past what Safari honours;
such a selection now travels on the window the click opens, the way the
rest of the portal passes a large case list, while smaller ones keep a
copyable link.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
The status bar asked which of two things a selection should do, and
defaulted to one of them. Masking is not really an alternative to
filtering: it is what a selection looks like, and the map reads better for
it - a neighbourhood against the whole picture rather than cut out of it.

So the mask is simply how a selection is drawn now, and the pair of mode
buttons is one Filter toggle: press it to narrow the map to the selection,
press it again to get the rest back. On the study view Make Global sits
beside it, to turn that same selection into a cohort filter for every tab.

The count now reads "selected" rather than "highlighted", since nothing is
being highlighted against anything else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
…ed for

Three things this map got wrong, found by using it.

The mark slid against the map as it was panned. The overlay projected data
coordinates itself and negated y, but the plot draws through an
OrthographicView built without `flipY`, which defaults to true: y runs
down the screen, so negating it mirrored the mark about the centre and the
error grew with every pan. It now asks deck for the projection, which also
knows the canvas's real size, and falls back to the arithmetic - corrected,
and with a test - only before the first frame. Probing at full zoom, the
mark's centre and its sample's point now agree to the pixel in both axes.

The mark then swelled until it covered what it pointed at. Growing it with
the zoom fixed its being lost among the points but had no end; it now
follows the points' own on-screen size between 18 and 30 pixels, so it
stays legible at any zoom and never hides its neighbourhood.

The map also warned, on the patient view, that it held fewer samples than
"this cohort". There is no cohort there - only the studies the map happens
to span - so the same sentence is information, and it now shows as such.
Where a cohort was actually chosen, the warning stands.

Loading waited on two things nothing had asked for. Every tooltip shows
Cancer Type, Cancer Type Detailed and Sample Type, so all three were
fetched across the whole map before it could draw, though only the one the
map is coloured by was needed; the others now wait for the first hover.
The gene list is 22,000 genes and 3 MB, and only the colour-by menu wants
it, so reaching for that menu is what starts it - unless a link names a
gene, which only the list can resolve. Three of the eight whole-map
clinical fetches and the gene list are off the critical path: first colour
at 10.6s against 17s.

A store that preloads alteration data per gene, rather than fetching it
per gene on demand, is now told which gene the map is coloured by.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
inodb and others added 2 commits November 19, 2026 00:20
The overlay projected through deck's own viewports, which describe the
frame deck last drew. The plot is controlled, so a drag or a zoom
re-renders the map and the overlay from the new view state and deck
draws afterwards: the mark was placed from the frame before, every frame,
for as long as the gesture lasted. It built its own viewport from the
view state the render is drawing.

The overlay also had no clipping, so a mark whose point had been panned
out of the plot carried on drawing over the page header.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
Clearing emptied the list but left the counter where it was, so the next
selection carried on from "Selection 8". The bookkeeping moves into
MapSelectionList, which restarts once nothing is held and keeps counting
while a chip is still on screen, so a number is never reused under one.

Each selection also keeps the lasso it was drawn with, in data
coordinates so it stays over the same points as the map moves, drawn in
the selection's own colour. The selections box takes the status bar's
colours while it holds anything, so the two read as one state.

Copy number asked each study's profile separately, which is thirty
requests the public API rate-limits, and structural variants named every
sample of every study in one body. Both now name the profiles instead:
one request each, answered in about a second.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
Reaching the page store's copy pulled in the patient's reference-cohort
machinery: every sample of the study and every clinical attribute on all
of them, 12 MB and an 8 s request that the colouring fetch then queued
behind. The map has its own sample list, so it can build the same
attributes from that without touching the cohort.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
The patient page's cohort options group on CANCER_TYPE and
CANCER_TYPE_DETAILED, but asked for every sample attribute in the
DETAILED projection, which repeats the whole clinical attribute object
on every row. On a 54,331-sample cohort that is ~620 MB of JSON to build
in the browser for two values per sample; naming the two attributes and
dropping to SUMMARY makes it ~32 MB.

The clinical data cache waited on coverage information for every
attribute, though only "Profiled In" reads it and deriving it costs a
gene panel fetch per study.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
Three things the selections beside a map got wrong.

The plot kept its own copy of the points a lasso picked, and draws every
point outside a selection grey. Clearing emptied the panel's list but not
that copy, so the map greyed itself against a selection already dismissed
and the points of it stayed the only coloured ones.

Numbering only ever counted up, so removing a selection left a hole the
next draw stepped over: 1, 3, 4. A new selection now takes the lowest
number no chip is using, and the list is held in that order.

The committed outlines drew above the controls and the legend, cutting
through what they say.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
inodb and others added 2 commits November 23, 2026 18:23
deck.gl sets its own cursor on the canvas, which wins over the
wrapper's style, so the mode never reached the pointer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
Colouring by a gene made the shared store ask each study's discrete
profile separately, purely to derive OncoKB copy-number annotation.
That is thirty requests here, and the public API answers roughly half
the burst with 429; each refusal left the colouring promise incomplete,
so the panel sat on a spinner that never cleared.

The map now hands the store the same rows from the single multi-profile
request it was already making, and reads the colouring off those rows
too. Selecting TP53 settles in 20s over 31 requests with none refused,
where before it never settled at all over 73.

Pending rather than not-complete also means a fetch the API does refuse
leaves the map uncoloured rather than wedged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j
The chips already carry the names the group comparison opens with, so
calling one "Luminal cluster" is worth more than "Selection 1". The
list could already rename; nothing reached it.

Enter or clicking away keeps what was typed, Escape leaves the old
name, and a blank one is not accepted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DEcTA69eJ2S5moAKuTJL2j

This branch was successfully deployed

1 active deployment
Preview — dc802429 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cl-prototype Prototype section in changelog. New features not ready for production use

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants