Conversation
This was referenced Sep 12, 2024
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.
Overview
This addresses a bug in the
ExperimentAxisQueryanndata exporter that is specific toobsm/varmarrays.Details
Currently, the number of columns needed for the resulting numpy array is taken from the
SparseNDArray's shape property, which provides the maximum capacity of the underlying TileDB array, rather than the occupied capacity. This results in the exporter allocating a far larger numpyndarraythan necessary when obsm/varm layers are included in the output.This issue is specific to
obsm/varmarrays because, unlikeX/obsp/varp, and as described here, their second dimension doesn't map to theobsorvaraxis and can include an arbitrary number of columns.Solution
With this PR the correct number of columns needed for the resulting numpy array is computed using the number of unique values present in the COO-formatted arrow table's
"soma_dim_1"column, which is already in-memory and doesn't require any additional TileDB queries.This solution is a temporary workaround, as
SparseNDArray.shape's behavior will change in an upcoming release of TileDB-SOMA (see here for status).Note: The TileDB-SOMA
SparseNDArrayclass does provide aused_shapeproperty that returns the occupied capacity of the underlying TileDB array that could be used, however, this is specific to the TileDB implementation and is not part of the SOMA API specification.[sc-51048].