Skip to content

Commit

Permalink
Add option to pass tiledb.Ctx object instead of tiledb.Config
Browse files Browse the repository at this point in the history
This enables use of mem:// url for dataset, which allows for easy import from np.ndarray
  • Loading branch information
hanslovsky committed Jan 21, 2025
1 parent 7a08b2a commit ec71f0a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cellarr/CellArrDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__(
gene_annotation_uri: str = "gene_annotation",
cell_metadata_uri: str = "cell_metadata",
sample_metadata_uri: str = "sample_metadata",
config: tiledb.Config = None,
config: tiledb.Config | tiledb.Ctx | None = None,
):
"""Initialize a ``CellArrDataset``.
Expand Down Expand Up @@ -141,12 +141,15 @@ def __init__(
Relative path to sample metadata store.
config:
Custom TileDB configuration. If None, defaults will be used.
Custom TileDB configuration or context. If None, defaults will be used.
"""
if config is None:
config = tiledb.Config()

ctx = tiledb.Ctx(config)
if isinstance(config, tiledb.Config):
ctx = tiledb.Ctx(config)
else:
assert isinstance(config, tiledb.Ctx)
ctx = config

self._dataset_path = dataset_path

Expand Down

0 comments on commit ec71f0a

Please sign in to comment.