Skip to content

Conversation

@rcannood
Copy link
Member

@rcannood rcannood commented Nov 18, 2025

Issue and/or context:

Now that anndataR is released at Bioconductor, we can add it to a dependency to the tiledbsoma r package so data can be read as a native AnnData object without being forced to use Seurat or SingleCellExperiment if it is not necessary.

Changes:

  • Added to_anndata(...) to convert a tiledbsoma object to an AnnData object
  • Added write_soma.AbstractAnnData(...) to convert an AnnData object to a tiledbsoma object
  • Added {anndataR} as a suggested package

Notes for Reviewer:

  • The to_anndata(...) function could use an argument as = c("InMemoryAnnData", "HDF5AnnData", "ReticulateAnnData"), ... to allow the user to specify which anndataR backend is used to create the AnnData object, and pass any additional parameter (e.g. path for HDF5AnnData)
  • The to_anndata(...) function currently reads everything in memory and then passes it to anndataR::AnnData -- we could move this logic such that first the AnnData object is created with just the obs and var, and other slots are then added to the AnnData to allow for better memory management.

Comment on lines +1442 to +1443
# Read in the remaining layers
layers <- if (length(X_layers) > 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to mention above that the first layer is stored as X

#' \item `varp` matrices are written out as [`SOMASparseNDArray`] objects
#' within the measurement's varp group.
#' }
#' Expression matrices are transposed (cells as rows) prior to writing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't they already stored this way in the AnnData or am I confused?

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.

3 participants