Skip to content

fix: resolve GEO series matrices by tag instead of line number (#208)#211

Open
marcbal77 wants to merge 6 commits into
bio-learn:masterfrom
marcbal77:fix/geo-series-matrix-tag-resolution
Open

fix: resolve GEO series matrices by tag instead of line number (#208)#211
marcbal77 wants to merge 6 commits into
bio-learn:masterfrom
marcbal77:fix/geo-series-matrix-tag-resolution

Conversation

@marcbal77

Copy link
Copy Markdown
Member

What

BoAChallengeData loaded an empty methylation matrix (930659 x 0 samples) with scrambled metadata. GEO re-versioned GSE246337_series_matrix.txt and 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. race1 ended up reading Sex: 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 GeoSeriesMatrix reader that resolves structure by the file's own tags and characteristic keys, the same technique AutoScanGeoMatrixParser already uses:

  • Metadata and column fields can be located by key: (a characteristic prefix) or tag: (a sample tag), which do not drift when the header moves.
  • id-row and the matrix start auto-detect from !Sample_geo_accession and !series_matrix_table_begin.
  • Legacy 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.
  • Empty column mappings, zero-sample matrices, and metadata that resolves to no usable values now raise instead of returning data that looks right and is not.

BoAChallengeData is migrated to key:/tag: and drops its brittle line numbers. The other geo-matrix configs are untouched and keep their exact behavior.

Testing

  • New test_geo_series_matrix.py covers the reader, key/tag/offset resolution, and the loud-failure paths against the local geo_dnam_test_file fixture and an in-memory BoA-shaped header.
  • Verified against the current GSE246337 series matrix: the mapping resolves to 500 sentrix-to-GSM pairs and the metadata (subject_id, sex, age, race) lands on the correct fields.
  • make format clean, full make test green (220 passed, 5 skipped).

Fixes #208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BoAChallengeData loads an empty methylation matrix (930659 × 0 samples): parser line numbers off-by-one vs current GSE246337 series matrix

1 participant