fix: ensure radius values stored in AnnData.uns are writable - #1249
Open
selmanozleyen wants to merge 1 commit into
Open
fix: ensure radius values stored in AnnData.uns are writable#1249selmanozleyen wants to merge 1 commit into
selmanozleyen wants to merge 1 commit into
Conversation
…rting tuples to lists
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1249 +/- ##
==========================================
+ Coverage 77.24% 77.31% +0.06%
==========================================
Files 63 63
Lines 9378 9380 +2
Branches 1579 1579
==========================================
+ Hits 7244 7252 +8
+ Misses 1532 1527 -5
+ Partials 602 601 -1
🚀 New features to boost your workflow:
|
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.
Closes #1247
RadiusBuilderandDelaunayBuilderstored an intervalradiusinadata.uns['spatial_neighbors']['params']as the tuple it was passed as.anndatahas no I/O spec for tuples, so any object built with a tupleradiusraised
IORegistryErroronwrite_h5ad/write_zarr.Store a list instead, via a small
_radius_to_unshelper. Scalar radii areunchanged. Note that
DelaunayBuilderalready normalizes a scalarrto(0.0, r)in__init__, sospatial_neighbors_delaunay(radius=5.0)now records[0.0, 5.0]— the same value as before, just writable.The abstract
GraphBuilder.uns_paramsdocstring now states that values must bewritable by
anndata, so custom builders don't reintroduce the same problem.Regression test covers both builders with scalar and interval radii, and asserts
on an actual
write_h5adrather than only on the stored value.