Skip to content

Genomic Evolution table: the Cohort column (PTB-GE-TB-1) - #500

Open
alisman wants to merge 1 commit into
masterfrom
patient-evolution-cohort-column
Open

alisman wants to merge 1 commit into
masterfrom
patient-evolution-cohort-column

Conversation

@alisman

@alisman alisman commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

PTB-GE-TB-1, part 3: the Genomic Evolution table gets the portal's Cohort column, last of its defaults, as in the patient mutation table.

  • Counts: each evolution row carries the study counts the Summary table's Cohort cell draws:
    • samples with a called mutation in the gene;
    • those with the row's keyword (KRAS G12 missense);
    • those whose panel covers the gene, the denominator.
  • Cohort %: blank for a mutation without a keyword, as the portal's (Patient mutations: no Cohort % for a mutation without a keyword, as the portal's #385). The cell is the same FrequencyBar and tooltip.
  • One source for both tables:
    • SQL: mutationCohortCtes, MUTATION_COHORT_JOIN, MUTATION_FREQ, MUTATION_COHORT_COUNTS and cohortOf are now exported from lib/patient-alterations.ts. They were extracted verbatim, so the Summary table's statements are byte-identical and its snapshots unchanged.
    • The cell: moved out of alterations-body.tsx into app/lab/cohort-cell.tsx.
    • Planted bugs: two existing ones (cohort-pct-no-keyword-shown, cohort-detail-keyword-count-is-gene-count) follow their moved sites and are still caught, checked by hand.
  • Method and caveat: both say how the % is computed (invariant 12).

Checked

  • Fixture: scripts/check-evolution-annotation.ts now has 14 checks.
    • C1: FX-P02 KRAS G12D is 24 of 59 samples, 16 with "KRAS G12 missense", 40.68%. Counted by hand from data_mutations.txt and the panel matrix: both panels cover KRAS; G12C/D/V are 16 samples.
    • C2: every FX-P01 and FX-P02 row's counts and % equal the Summary table's.
  • Warehouse, lgg_ucsf_2014 P04 in a headless browser: the rows both tabs show have identical tooltips, e.g. TP53 R248Q "55 samples (90%) in this study have mutated TP53, out of which 4 (7%) have TP53 R248 missense mutations."
  • Snapshot: evolution re-recorded.
  • Tests:
    • test/view-evolution.test.ts: the source uses the Patient tables' CTEs, join and %, with Cohort last.
    • npm test: 7192 pass, 0 fail (39 todo). eslint is clean on the touched files.
  • Planted bug evolution-cohort-no-keyword (guard evolution-annotation): applied by hand, it fails C1 and C2; the file was restored.
  • Sites checked by script: each find occurs exactly once (762 bugs, 0 bad).
  • Merges cleanly with Pathways: the "Sample(s) … not profiled for …" alert (PTB-PW-1) #487 and Timeline: the portal's root labels, sub-track order, hovered row and same-day lab values (PAT-TL-TR-1, TR-2, TR-5, TT-4) #495.

Tracker

docs/legacy-spec/parity/41-patient-tabs.md

ID verdict how note
PTB-GE-TB-1 🔶 B Columns Samples · Gene · Protein Change · Annotation (OncoKB) ✅ (#488) · Mutation Type · VAF by sample · Max VAF · Cohort % ✅ (8/15): Cohort as the Summary table's, its counts and % equal on the fixture (FX-P02 KRAS G12D 24/59, 16 with its keyword) and its tooltips on lgg_ucsf_2014 P04; 10 rows ✅; "Show only selected mutations" ✅ (#481); no Allele Freq bars

docs/PORTAL-PARITY.md, in "High — daily-use features, data already loaded", item **Patient → Genomic Evolution**, under its sub-item Table: Annotation, Allele Freq bars and Cohort columns; the portal's page size (ours 25) (PTB-TB-1) (still [ ]), beside #488's line, add:

- [x] The Cohort column, the Summary table's FrequencyBar and counts, last of the defaults (PTB-GE-TB-1) (#500)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q3ezTVY3MHJRLp4DsZ9c7C


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The portal's Genomic Evolution table ends its default columns with Cohort, as
the patient mutation table does. Each evolution row now carries the study
counts the Summary table's Cohort cell draws: samples with a called mutation
in the gene, those with the row's keyword, and those whose panel covers the
gene. Its Cohort % is blank without a keyword, as the portal's. The cell is
the same FrequencyBar and tooltip.

One source for both tables:
- SQL (lib/patient-alterations.ts): mutationCohortCtes, MUTATION_COHORT_JOIN,
  MUTATION_FREQ, MUTATION_COHORT_COUNTS and cohortOf, extracted verbatim, so
  the Summary table's statements are unchanged.
- The cell: app/lab/cohort-cell.tsx, moved out of alterations-body.
- The caveat and method record say how the % is computed.

Checked on the fixture (scripts/check-evolution-annotation.ts, now 14
checks): FX-P02 KRAS G12D is 24 of 59 samples, 16 with "KRAS G12 missense",
40.68%, as counted by hand from data_mutations.txt and the panel matrix.
Every FX-P01 and FX-P02 row's counts and % equal the Summary table's. On
lgg_ucsf_2014 P04, the rows both pages show have identical tooltips (TP53
R248Q "55 samples (90%) … 4 (7%) have TP53 R248 missense mutations"). The
evolution snapshot was re-recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTVY3MHJRLp4DsZ9c7C
@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 10:42pm UTC
cbiolab-new Ready Ready Preview Nov 19, 2026 10:42pm UTC
cohort-lab Ready Ready Preview Nov 19, 2026 10:42pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – cohort-lab — c5d4d231 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