Skip to content

[python] fix incorrect typing of exported obs/var annotation matrices#4139

Merged
bkmartinjr merged 52 commits intomainfrom
bkm/soma-322-to-anndata-dtype
Jun 26, 2025
Merged

[python] fix incorrect typing of exported obs/var annotation matrices#4139
bkmartinjr merged 52 commits intomainfrom
bkm/soma-322-to-anndata-dtype

Conversation

@bkmartinjr
Copy link
Copy Markdown
Member

@bkmartinjr bkmartinjr commented Jun 23, 2025

ExperimentAxisQuery.to_anndata was always exporting obsm/varm matrices as float32, regardless of their actual data type. This PR fixes the bug, and uses the underlying SOMA matrix data type to determine the matrix type to add to the anndata.

Changes:

  • to_anndata uses schema to determine correct NumPy array for obsm/varm slots
  • fixed a multi-threading race observed while debugging this (in code private to ExperimentAxisQuery)
  • a couple of freebie Ruff reformats related to commas

Fixes SOMA-322

@bkmartinjr bkmartinjr marked this pull request as ready for review June 23, 2025 20:13
@bkmartinjr bkmartinjr requested review from jp-dark and ktsitsi June 23, 2025 20:13
@bkmartinjr bkmartinjr marked this pull request as draft June 23, 2025 21:04
@bkmartinjr
Copy link
Copy Markdown
Member Author

reverting to draft while I chase the SIGSEGV occurring in the MacOS tests

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.47%. Comparing base (5262c63) to head (ba52487).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4139       +/-   ##
===========================================
+ Coverage   66.22%   89.47%   +23.25%     
===========================================
  Files         161       60      -101     
  Lines       19860     7164    -12696     
  Branches     1235        0     -1235     
===========================================
- Hits        13152     6410     -6742     
+ Misses       6300      754     -5546     
+ Partials      408        0      -408     
Flag Coverage Δ
libtiledbsoma ?
python 89.47% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
python_api 89.47% <100.00%> (-0.02%) ⬇️
libtiledbsoma ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bkmartinjr bkmartinjr marked this pull request as ready for review June 26, 2025 00:11
@bkmartinjr bkmartinjr merged commit 91ae923 into main Jun 26, 2025
18 checks passed
@bkmartinjr bkmartinjr deleted the bkm/soma-322-to-anndata-dtype branch June 26, 2025 00:58
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.

2 participants