[r] Write ragged arrays relatively#4450
Open
mojaveazure wants to merge 9 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4450 +/- ##
==========================================
- Coverage 85.27% 85.23% -0.04%
==========================================
Files 136 136
Lines 21266 21298 +32
==========================================
+ Hits 18135 18154 +19
- Misses 3131 3144 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
jp-dark
requested changes
Apr 23, 2026
jp-dark
reviewed
Apr 23, 2026
Calling `write_soma()` on a `Seurat` v5 object with ragged arrays using
an absolute file URI (eg. `/home/user/directory`) resulted in the SOMA
NDArrays for the ragged `Seurat` matrices having absolute URIs instead
of the intuitive relative arrays. This PR changes URI setting to be
relative in this case
Modified SOMA methods:
- `SOMACollectionBase$private$.set_element()`: for non-Carrara URIs,
always set the element relatively
Note for reviewers: this PR introduces new tests to write a ragged
`Seurat` v5 object to an absolute file URI and uploads it to S3 to
ensure the member URIs are relative. These tests require the following
before running:
- package [{aws.s3}](https://cran.r-project.org/package=aws.s3) to be
installed
- environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
to be set for authentication
- environment variable `AWS_S3_BUCKET` to be set to know where to
upload the SOMA to
If these conditions are met, then the tests run. Otherwise, they are
skipped. Tests also do not run under coverage, on macOS, or on CRAN
(`!extended_tests()`)
These tests do attempt to cleanup on test exit or failure. The uploaded SOMA
will be deleted when the test exits scope. If the bucket provided by
`AWS_S3_BUCKET` does not exist prior to running, it will be created
during the test and deleted when teh test exists scope. If it already
exists, then it will be left alone
As CI does not satisify these conditions, these tests will not run on
CI. Here's an example of these tests running locally
```bash
paul@tiledb-ph:~/software/TileDB-SOMA/apis/r$ AWS_S3_BUCKET='test-ragged-s3' Rscript -e 'devtools::load_all()' -e 'testthat:
:test_file("tests/testthat/test-14-SeuratIngest.R", reporter = "location")'
Start test: Ragged array uploads to S3 (SOMA-906)
test-14-SeuratIngest.R:618:3 [success]
test-14-SeuratIngest.R:622:3 [success]
test-14-SeuratIngest.R:660:3 [success]
test-14-SeuratIngest.R:662:3 [success]
test-14-SeuratIngest.R:663:3 [success]
test-14-SeuratIngest.R:665:5 [success]
test-14-SeuratIngest.R:665:5 [success]
test-14-SeuratIngest.R:665:5 [success]
test-14-SeuratIngest.R:665:5 [success]
End test: Ragged array uploads to S3 (SOMA-906)
```
Fixes [SOMA-906](https://linear.app/tiledb/issue/SOMA-906/r-mixed-uri-types-in-somaexperiments-created-via-write-seurat)
add tests for new behavior
mojaveazure
force-pushed
the
phoffman/soma-906-r-mixed-uri-types-in-somaexperiments-created-via
branch
from
April 24, 2026 18:03
93f0661 to
36ca210
Compare
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.
Calling
write_soma()on aSeuratv5 object with ragged arrays using an absolute file URI (eg./home/user/directory) resulted in the SOMA NDArrays for the raggedSeuratmatrices having absolute URIs instead of the intuitive relative arrays. This PR changes URI setting to be relative in this caseModified SOMA methods:
SOMACollectionBase$add_new_sparse_ndarray(): now takes a parameterrelative; defaults toTRUEwrite_soma()methods forSeurat,SingleCellExperiment, andSummarizedExperiment: disallow passing arguments via...write_soma()methods forAssay,Assay5,DimReduc,Graph, andSeuratCommandproperly passrelativeto other write-methodsFixes SOMA-906