Skip to content

Study View filter bar: gene-table selections as a pill per gene, coloured by alteration (STV-FB-3 #9) - #457

Merged
alisman merged 4 commits into
masterfrom
studyview-gene-pills
Nov 19, 2026
Merged

alisman merged 4 commits into
masterfrom
studyview-gene-pills

Conversation

@alisman

@alisman alisman commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A gene table's selection now reads in Explore's filter bar as the portal draws it (STV-FB-3 #9):

  • One pill per gene, the symbol only: a Union of APC and TP53 reads "( APC or TP53 )". It was one generic pill, "OQL APC: MUT; TP53: MUT".
  • Coloured by what its table counts, in the oncoprint's colours (STYLE.glyph, invariant 8): a mutation green #008000, a structural variant purple #8b00c9, an amplification red #ff0000, a deep deletion blue #0000ff.
  • The OQL line in the pill's tooltip ("TP53: MUT_DRIVER" under drivers only).
  • Its own ×, which takes only that gene out of the selection; the clause goes with its last gene (removeOqlLine). Before, the × removed the whole selection.
  • Typed OQL, and a Gene status chart's clauses, keep the generic pill. Only a clause a gene table wrote is read this way: it carries the table's name ("chart" on the oql leaf, written since Study View: Add chart's Genomic tab (STV-AC-2, STV-AC-4) #455), and its lines are "GENE: MUT|AMP|HOMDEL|FUSION", optionally _DRIVER (geneTablePills, lib/study-view-pills.ts). A Gene status chart writes the same text ("KRAS: MUT" beside "profiled KRAS"), untagged.
  • Other OR groups (gene charts, typed OQL) keep Study View filter bar: the portal's words between groups (STV-FB-2) #453's "( a or b )".

Spec IDs

Verification

  • Browser, dev server, coadread:

    • APC + TP53 (Union), then KRAS, read "( APC × or TP53 × ) KRAS ×".
    • Each pill is rgb(0, 128, 0), with the tooltips "APC: MUT", "TP53: MUT", "KRAS: MUT".
    • 201 patients match, unchanged.
    • With a KRAS Gene status "Mutated" filter as well, the bar reads "profiled KRAS · OQL KRAS: MUT and ( APC or TP53 )": the Gene status clause stays a generic pill.
    • No page errors.
  • e2e: the drivers step in test/e2e/explore.cjs waited for the text "EGFR: MUT_DRIVER" in the filter bar. That text now sits in the pill's tooltip, so the step waits for the pill whose tooltip it is. Run on its own against my dev server: pass (60 counted, 60 matched).

  • Unit tests: in test/study-view-pills.test.ts:

    • the four alterations and _DRIVER with their colours;
    • typed OQL ("KRAS: MUT=G12C", a mix, a bare gene, GAIN, empty) left alone;
    • an untagged "KRAS: MUT" (a Gene status chart's) left alone;
    • removing one gene keeps the tag on the rest;
    • removing one gene, then the last;
    • the draft given is left unchanged.

    npm test 6,884 pass, 0 fail (with master merged in).

  • Coverage: passes.

  • Planted bugs: 3 in scripts/mutants/study-view/gene-pills.ts (guard unit).

Tracker

Under "Study View → filters, actions and tabs", this line (docs/PORTAL-PARITY.md:471):

becomes what is left:

Scorecard 31-study-view-shell.md, row STV-FB-3 (was | STV-FB-3 | 🟡 | B | Clinical (incl. NA) named by the chart's display name, a pill per value or range; gene, GA, case-list, event and derived clauses still the generic pills; no group-filter or treatment pills |):

| STV-FB-3 | 🟡 | B | Clinical (incl. NA) named by the chart's display name, a pill per value or range; gene-table selections a pill per gene coloured by alteration (geneTablePills); gene-chart, GA, case-list, event and derived clauses still the generic pills; no group-filter or treatment pills |

Preview

/lab?tab=explore&study=coadread_tcga_pan_can_atlas_2018: check APC and TP53 in Mutated Genes, Apply filter; then KRAS.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht

…oloured by alteration (STV-FB-3 #9)

As the portal's filter bar: a gene-table selection reads "( APC or TP53 )",
each gene its own pill coloured by what its table counts, the oncoprint's
colours (mutation green, structural variant purple, amplification red,
deep deletion blue), its OQL line in the tooltip, and its own ×, which
takes only that gene out (geneTablePills, removeOqlLine). Typed OQL and
a gene chart's clauses keep the generic pill.

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

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cbiolab-genie Ready Ready Preview Nov 19, 2026 3:29pm UTC
cbiolab-new Ready Ready Preview Nov 19, 2026 3:29pm UTC
cohort-lab Ready Ready Preview Nov 19, 2026 3:29pm UTC

Request Review

Comment thread app/lab/study-view-pills.tsx Outdated
/** any other clause: a gene table's selection as the portal draws it, a pill per gene coloured by alteration (STV-FB-3 #9); else the generic pill */
const other = (clause: number) => {
const genes = geneTablePills(draft.all![clause]);
if (!genes) return <ClausePill key={clause} clause={draft.all![clause]} onRemove={() => onRemoveClause(clause)} onCustomData={onCustomData} />;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic ClausePill fallback dropped the portal prop the old code passed (<ClausePill ... portal />). Every non-gene-table clause (typed OQL, gene-chart clauses, etc.) in the study-view bar now renders in the non-portal style, a regression unrelated to this feature. Re-add portal.

@alisman

alisman commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Review verdict: changes

Blocking:

  • Regression of STV-FB-2 (Study View filter bar: the portal's words between groups (STV-FB-2) #453): the generic-clause path in app/lab/study-view-pills.tsx now renders <ClausePill … /> without the portal prop that master passes, so every non-gene-table OR group (gene charts, case lists, GA, …) goes back to "a OR b" with no parentheses instead of the portal's "( a or b )". Restore portal on that ClausePill (and ideally a test that pins it).

Checked and fine: one pill per gene with the OQL line in the tooltip; colours match legacy STV-FB-3 #9 (MUT_COLOR_MISSENSE #008000, SV #8b00c9, AMP #ff0000, HOMDEL #0000ff) via the shared STYLE.glyph tokens; removing a gene drops only its line, the last gene drops the clause (unit-tested, plus a planted bug); joinedByAnd grouping unchanged; typed OQL keeps the generic pill. CI: all green except gate-e2e still pending at review time.

alisman and others added 3 commits November 19, 2026 14:23
The fallback pill for clauses that are not a gene table's selection passes `portal` again, as
master does, so gene-chart and typed-OQL OR groups keep #453's parentheses and lower-case "or".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
… wrote, by their tag

geneTablePills now needs the table's name on the clause (`chart`, written by geneSelection since
#455), so a Gene status chart's "KRAS: MUT" beside its "profiled KRAS" keeps the generic pill and
its × no longer removes the alteration alone. Removing one gene keeps the tag on the rest.
Seen on coadread: KRAS Mutated + APC, TP53 from Mutated Genes reads
"profiled KRAS · OQL KRAS: MUT and ( APC or TP53 )".

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

alisman commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in d4eb382, with master merged in:

  • Blocking: portal is back on the fallback ClausePill (4e65895), as master passes it, so other OR groups keep "( a or b )".
  • Also: since Study View: Add chart's Genomic tab (STV-AC-2, STV-AC-4) #455, a gene table's clauses carry its name (chart). geneTablePills now requires it, so a Gene status chart's "KRAS: MUT" (beside its "profiled KRAS") keeps the generic pill, and its × no longer removes the alteration alone. Test first, plus a planted bug for it.
    • Browser, coadread: a KRAS Gene status Mutated filter plus APC and TP53 from Mutated Genes reads "profiled KRAS · OQL KRAS: MUT and ( APC or TP53 )", 201 patients.

npm test 6,884 pass, 0 fail; tsc --noEmit and eslint clean.

@alisman

alisman commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Re-review: pass. 4e65895 puts portal back on the fallback ClausePill, so the other OR groups read "( a or b )" again, as in #453. d4eb382 also uses #455's chart tag to decide which clauses become per-gene pills. An untagged clause, such as typed OQL or a Gene status chart's "KRAS: MUT" beside its "profiled KRAS", keeps the generic pill, so its × can't drop the alteration alone and widen the cohort. The new planted bug gene-pills-untagged-oql is caught by the added test.

Note: the per-gene pills need #455's tags, so until #455 merges, gene-table clauses show as generic pills. That's harmless.

@alisman
alisman added this pull request to the merge queue Nov 19, 2026
Merged via the queue into master with commit 08462ec Nov 19, 2026
19 of 20 checks passed
@alisman
alisman deleted the studyview-gene-pills branch November 19, 2026 16:27

This branch was successfully deployed

1 active deployment
Preview – cohort-lab — d4eb382a Deployed Nov 19, 2026 by vercel[bot]
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