fix: resolve GEO series matrices by tag instead of line number (#208)#211
Open
marcbal77 wants to merge 6 commits into
Open
fix: resolve GEO series matrices by tag instead of line number (#208)#211marcbal77 wants to merge 6 commits into
marcbal77 wants to merge 6 commits into
Conversation
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.
What
BoAChallengeDataloaded an empty methylation matrix (930659 x 0 samples) with scrambled metadata. GEO re-versionedGSE246337_series_matrix.txtand every header line shifted down by one, but the curated parser config still pointed at the old absolute line numbers, so the betas-to-sample mapping resolved to nothing and every sample column was pruned.race1ended up readingSex: M.This was not unique to BoA. All of the curated GEO datasets encode line numbers that rot the same way on the next GEO revision, and the failure was silent.
Approach
Series matrix headers are self-describing, so absolute line numbers are the wrong anchor. This adds a
GeoSeriesMatrixreader that resolves structure by the file's own tags and characteristic keys, the same techniqueAutoScanGeoMatrixParseralready uses:key:(a characteristic prefix) ortag:(a sample tag), which do not drift when the header moves.id-rowand the matrix start auto-detect from!Sample_geo_accessionand!series_matrix_table_begin.row:configs self-correct. The offset between the configured and the actual id-row is applied to every metadata row, so a uniform header shift heals on its own. For an unshifted dataset the offset is 0 and the output is identical.BoAChallengeDatais migrated tokey:/tag:and drops its brittle line numbers. The other geo-matrix configs are untouched and keep their exact behavior.Testing
test_geo_series_matrix.pycovers the reader, key/tag/offset resolution, and the loud-failure paths against the localgeo_dnam_test_filefixture and an in-memory BoA-shaped header.GSE246337series matrix: the mapping resolves to 500 sentrix-to-GSM pairs and the metadata (subject_id, sex, age, race) lands on the correct fields.make formatclean, fullmake testgreen (220 passed, 5 skipped).Fixes #208.