Fix/efp relative mode per group control from global control#178
Closed
Fix/efp relative mode per group control from global control#178
Conversation
…e mode, had to add extra variables to include both absolute and relative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix eFP relative mode per-group control
Problem
The eFP relative color mode and log2 fold change tooltip were using
data.control— the average of all group controls across the entire experiment — instead of each tissue's owngroup.control. This produced incorrect colours and values in any experiment where groups have different controls.Example: Biotic Stress Botrytis cinerea eFP, AT3G24650
The 18hr group has a control mean of 6.59, the 48hr group has 10.77. The old code averaged these to ~8.68 and used that for everything.
| Tissue | Expected log2 FC | Before | After |
| Mock Treatment (Control) 18hr | 0.00 | -0.40 | 0.00 |
| Treated 18hr | -0.15 | -0.55 | -0.16 | *off by 0.01 due to rounding
| Control 48hr | 0.00 | 0.31 | 0.00 |
XML: https://bar.utoronto.ca/eplant/data/experiment/efps/BioticStressBotrytiscinerea/Arabidopsis_thaliana.xml
The control tissues in each group should always show a fold change of 0.00 and render as neutral/yellow in relative mode. They didn't.
Fix
Commit 1 — per-group control for relative mode
EFPTooltip.tsx: tooltip log2 fold change now usesgroup.control(falls back todata.control, then1)svg.tsx:useStylespassesgroupinstead ofdatatogetColor, so the relative-mode extremum calculation scales against the group's own min/max and controllegend.tsx: removed unusedEFPStateimport; added a comment noting the legend is a global approximation that may not exactly match per-group coloursCommit 2 — preserve absolute mode scaling
grouptogetColormeant absolute colours normalised againstgroup.maxinstead of the experiment-widedata.max, making every tissue appear fully redabsoluteMaxparameter togetColor; absolute mode now usesabsoluteMax ?? group.maxuseStylespassesdata.maxas the new argumentlegend.tsxunchanged — it already passesdataas its group arg, so the fallback resolves correctlyWhat was NOT changed
<control>tags are parsed correctlytypes.tsxor the loader inviews/eFP/index.tsx— per-group control was already computed correctly; only downstream consumers were ignoring it, so we are just making sure it gets readdata.controlaggregate field — it remains as a fallbackScreenshots
Relative mode — before (wrong fold changes) → after (correct)
Note
The
Eplant/main.tsxchange (routerbasename) is from<other-branch-name>, included because this branch is based on it. It will disappear from this diff once that PR merges.