From 2090db2bc8b561b10605cbff132e59750a78e21f Mon Sep 17 00:00:00 2001 From: Vin Date: Thu, 16 Apr 2026 02:25:11 -0400 Subject: [PATCH 1/4] fix: use per-group control for tooltip log2 fold change --- Eplant/views/eFP/Viewer/EFPTooltip.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Eplant/views/eFP/Viewer/EFPTooltip.tsx b/Eplant/views/eFP/Viewer/EFPTooltip.tsx index c69945d6..72b2fc36 100644 --- a/Eplant/views/eFP/Viewer/EFPTooltip.tsx +++ b/Eplant/views/eFP/Viewer/EFPTooltip.tsx @@ -124,7 +124,8 @@ function SVGTooltip(props: { From 4521ef78838e55079ad13b62a0ec5d66972bbd82 Mon Sep 17 00:00:00 2001 From: Vin Date: Thu, 16 Apr 2026 02:27:51 -0400 Subject: [PATCH 2/4] fix: use per-group control and min/max for eFP colour scale in relative mode --- Eplant/views/eFP/svg.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Eplant/views/eFP/svg.tsx b/Eplant/views/eFP/svg.tsx index 03e7ebdd..dc09c7c9 100644 --- a/Eplant/views/eFP/svg.tsx +++ b/Eplant/views/eFP/svg.tsx @@ -139,8 +139,8 @@ export function useStyles( tissue.id } { fill: ${getColor( tissue.mean, - data, - control ?? 1, + group, + group.control ?? control ?? 1, theme, colorMode, tissue.std, From 0da39030b5fad95ff97022f611247a2e8ea1c3e1 Mon Sep 17 00:00:00 2001 From: Vin Date: Thu, 16 Apr 2026 02:48:05 -0400 Subject: [PATCH 3/4] Documentation/Note: add TODO comment to legend for per-group control approximation --- Eplant/views/eFP/Viewer/legend.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Eplant/views/eFP/Viewer/legend.tsx b/Eplant/views/eFP/Viewer/legend.tsx index 59837fd2..2361f594 100644 --- a/Eplant/views/eFP/Viewer/legend.tsx +++ b/Eplant/views/eFP/Viewer/legend.tsx @@ -1,7 +1,7 @@ import { Box, styled, useTheme } from '@mui/material' import { getColor } from '../svg' -import { ColorMode, EFPData, EFPState } from '../types' +import { ColorMode, EFPData } from '../types' interface ILegendProps { data: EFPData @@ -18,6 +18,11 @@ export default styled(function Legend({ ...rest }: ILegendProps) { const theme = useTheme() + // TODO: legend uses data.control (cross-group average) and data.min/max as a + // global approximation. This can diverge from per-group colours when groups + // have different controls. A per-group legend is out of scope for this fix. + // I.e. The colours may not line up in this commit/PR due to group colours being different + // than the global legend const control = data.control ?? 1 const values = Array(GRADIENT_STEPS) .fill(0) From e0e73486d227751e495be1b4fcee87025516827f Mon Sep 17 00:00:00 2001 From: Vin Date: Thu, 16 Apr 2026 03:15:31 -0400 Subject: [PATCH 4/4] fix: use experiment-wide max for absolute mode, per-group for relative mode, had to add extra variables to include both absolute and relative --- Eplant/views/eFP/svg.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Eplant/views/eFP/svg.tsx b/Eplant/views/eFP/svg.tsx index dc09c7c9..0f572cf5 100644 --- a/Eplant/views/eFP/svg.tsx +++ b/Eplant/views/eFP/svg.tsx @@ -96,7 +96,8 @@ export function getColor( colorMode: ColorMode, tissueStd?: number, maskThreshold?: number, - maskingEnabled?: boolean + maskingEnabled?: boolean, + absoluteMax?: number ): string { const extremum = Math.max( Math.abs(Math.log2(group.min / control)), @@ -118,7 +119,7 @@ export function getColor( return mix( theme.palette.neutral.main, theme.palette.hot.main, - value / group.max + value / (absoluteMax ?? group.max) ) } @@ -145,7 +146,8 @@ export function useStyles( colorMode, tissue.std, maskThreshold, - maskingEnabled + maskingEnabled, + data.max )} !important; }` ) )