Skip to content

KPMP-6608: New col#631

Merged
HaneenT merged 2 commits into
developfrom
KPMP-6608_Comparison_Col
Mar 23, 2026
Merged

KPMP-6608: New col#631
HaneenT merged 2 commits into
developfrom
KPMP-6608_Comparison_Col

Conversation

@zwright

@zwright zwright commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added a new sortable comparison column for regional analysis views, providing distinction between targeted and comprehensive region comparisons.

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown

Walkthrough

Added a conditional grid column to the DiffexByCluster component when dataType is 'rt'. The column is sortable, displays comparison information via InfoHeader with tooltip, and formats segment name values based on their type (special handling for Glomerulus/Renal Corpuscle versus other regions).

Changes

Cohort / File(s) Summary
Conditional Region Comparison Column
src/components/ExpressionTables/DiffexByCluster.js
Added sortable COMPARISON grid column that appears when dataType === 'rt'. Uses InfoHeader with tooltip describing region comparisons. Formats segmentName values: 'Glomerulus / Renal Corpuscle' displays as 'to Glom/TI (only)', all others as 'to all regions'.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch KPMP-6608_Comparison_Col

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/ExpressionTables/DiffexByCluster.js (1)

119-119: Avoid hardcoded comparison string and guard unknown values in formatter.

Line 119 hardcodes 'Glomerulus / Renal Corpuscle' instead of reusing CellTypeEnum.GLOM (src/components/Explorer/CellTypeEnum.js), and any unexpected/empty value is currently mislabeled as "to all regions".

♻️ Proposed refactor
+import CellTypeEnum from '../Explorer/CellTypeEnum';
...
- valueFormatter: params => params.value === 'Glomerulus / Renal Corpuscle' ? 'to Glom/TI (only)' : 'to all regions'
+ valueFormatter: ({ value }) => {
+   if (value === CellTypeEnum.GLOM) return 'to Glom/TI (only)';
+   if (!value) return '—';
+   return 'to all regions';
+ }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f9875436-a8d9-4c1e-9f26-430e10c75719

📥 Commits

Reviewing files that changed from the base of the PR and between dccc0c6 and a92e909.

📒 Files selected for processing (1)
  • src/components/ExpressionTables/DiffexByCluster.js

Comment on lines +110 to +122
if (this.props.dataType === 'rt') {
columns.push(
{
headerName: 'COMPARISON',
headerComponent: InfoHeader,
headerComponentParams: { infoIcon: true },
sortable: true,
headerTooltip: 'Expression measured against all regions or just Glomerulus vs Tubulo-interstitium.',
field: 'segmentName',
valueFormatter: params => params.value === 'Glomerulus / Renal Corpuscle' ? 'to Glom/TI (only)' : 'to all regions'
}
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Include the new COMPARISON field in CSV export for rt.

Line 110 adds a visible comparison column, but cleanResults does not export it for rt, so users download less context than they see in the grid.

📥 Proposed fix (includes changes outside this hunk)
 cleanResults = (results, dataType) => {
   if (dataType === "rp"){
     return results.map(({ accession, foldChange, pValAdj }) => {
       return {
           protein: accession,
           foldChange: formatNumberToPrecision(foldChange, 3),
           pValAdj: formatNumberToPrecision(pValAdj, 3, true)
       }
     });
   }
-  else {
+  else if (dataType === "rt") {
+    return results.map(({ gene, segmentName, foldChange, pVal, pValAdj }) => ({
+      gene,
+      comparison: segmentName === CellTypeEnum.GLOM ? 'to Glom/TI (only)' : 'to all regions',
+      foldChange: formatNumberToPrecision(foldChange, 3),
+      pVal: formatNumberToPrecision(pVal, 3),
+      pValAdj: formatNumberToPrecision(pValAdj, 3, true)
+    }));
+  } else {
     return results.map(({ gene, foldChange, pVal, pValAdj }) => {
       return {
           gene: gene,
           foldChange: formatNumberToPrecision(foldChange, 3),
           pVal: formatNumberToPrecision(pVal, 3),
           pValAdj: formatNumberToPrecision(pValAdj, 3, true)
       }
   });
   }
 };

@HaneenT HaneenT merged commit d5e7057 into develop Mar 23, 2026
1 check passed
@HaneenT HaneenT deleted the KPMP-6608_Comparison_Col branch March 23, 2026 17:55
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.

2 participants