KPMP-6608: New col#631
Conversation
WalkthroughAdded 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
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 reusingCellTypeEnum.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
📒 Files selected for processing (1)
src/components/ExpressionTables/DiffexByCluster.js
| 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' | ||
| } | ||
| ); | ||
| } |
There was a problem hiding this comment.
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)
}
});
}
};
Summary by CodeRabbit