Fix row alignment bug in getWithColData append mode#346
Closed
aboyoun wants to merge 1 commit intowaldronlab:develfrom
Closed
Fix row alignment bug in getWithColData append mode#346aboyoun wants to merge 1 commit intowaldronlab:develfrom
aboyoun wants to merge 1 commit intowaldronlab:develfrom
Conversation
When mode=append, existing (experiment colData) and leftovers (MAE colData) had incompatible row orderings, causing patient metadata to be assigned to wrong samples. Fix uses sampleMap to properly align rows before cbind. Reported by James Bonaffini. Includes regression test.
Collaborator
|
Thanks Patrick and James for the fix ! 5388577 |
|
Thanks @aboyoun for the writeup! |
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 row alignment bug in getWithColData append mode
Fixes a data corruption bug in
getWithColData()whenmode="append"where patient metadata was assigned to incorrect samples.Problem
When appending MAE
colDatato experimentcolData, the function performed positionalcbind()on two DataFrames with incompatible row orderings:existing(experiment colData): indexed by sample IDsleftovers(MAE colData): indexed by patient IDs in sampleMap orderThis caused silent data corruption where samples received metadata from different patients (e.g., sample from patient M99 getting patient M4's age, treatment, outcome data).
Solution
Added row alignment step using
sampleMapto reorderleftoversbeforecbind:Changes
R/MultiAssayExperiment-helpers.R: Fixed row ordering ingetWithColData()append branchtests/testthat/test-MultiAssayExperiment-helpers.R: Added regression test with mismatched row ordersDESCRIPTION: Version bump to 1.37.4Testing
Regression test verifies that when experiment colData and sampleMap have different row orders, each sample correctly receives its associated patient's metadata from MAE colData.
Credit
Bug reported and diagnosed by James Bonaffini.