-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[r] Write group-level string metadata as
TILEDB_STRING_UTF8
(#3469)
* [r] Write group-level string metadata as `TILEDB_STRING_UTF8` String group-level metadata was previously encoded using `TILEDB_CHAR` or `TILEDB_STRING_ASCII`; however, this resulting in the metadata being read in as `bytes` in the Python API instead of as `str`. The Python API already [encodes all strings (`str`) as `TILEDB_STRING_UTF8`](https://github.com/single-cell-data/TileDB-SOMA/blob/884342a1ceb994d677c52c74ba2d789fc4e208d4/apis/python/src/tiledbsoma/common.cc#L211-L223) so this PR brings the R API in-line with the Python API [SC-61001](https://app.shortcut.com/tiledb-inc/story/61001) resolves #2698 * Add tests * Update test * Attempt to fix Python nonsense * Fix more Python nonsense * Use spaces instead of tabs * Update changelog Bump develop version
- Loading branch information
1 parent
4fbbebe
commit bda7d97
Showing
5 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ Description: Interface for working with 'TileDB'-based Stack of Matrices, | |
like those commonly used for single cell data analysis. It is documented at | ||
<https://github.com/single-cell-data>; a formal specification available is at | ||
<https://github.com/single-cell-data/SOMA/blob/main/abstract_specification.md>. | ||
Version: 1.16.99 | ||
Version: 1.16.99.1 | ||
Authors@R: c( | ||
person(given = "Aaron", family = "Wolen", | ||
role = c("cre", "aut"), email = "[email protected]", | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import pytest | ||
|
||
import tiledbsoma | ||
|
||
from .common import TestWritePythonReadR | ||
|
||
|
||
class TestCharacterMetadataWritePythonReadR(TestWritePythonReadR): | ||
|
||
@pytest.fixture(scope="class") | ||
def experiment(self): | ||
exp = tiledbsoma.Experiment.create(self.uri) | ||
exp.close | ||
|
||
def base_R_script(self): | ||
return f""" | ||
library(tiledbsoma) | ||
exp <- SOMAExperimentOpen("{self.uri}") | ||
md <- exp$get_metadata() | ||
""" | ||
|
||
def test_r_character(self, experiment): | ||
self.r_assert( | ||
"stopifnot(all(vapply(md, \(x) is.character(x$name), logical(1L))))" | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import pytest | ||
|
||
import tiledbsoma | ||
|
||
from .common import TestReadPythonWriteR | ||
|
||
|
||
class TestCharacterMetadataWriteRReadPython(TestReadPythonWriteR): | ||
@pytest.fixture(scope="class") | ||
def R_character(self): | ||
base_script = f""" | ||
library(tiledbsoma) | ||
exp <- SOMAExperimentCreate("{self.uri}") | ||
exp$close() | ||
""" | ||
self.execute_R_script(base_script) | ||
|
||
def test_py_character(self, R_character): | ||
with tiledbsoma.open(self.uri) as exp: | ||
for key in exp.metadata.keys(): | ||
assert isinstance(exp.metadata.get(key), str) |