Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Make tiledbsoma integration compatible with tiledbsoma==1.15.0 #2307

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lamindb/core/storage/_tiledbsoma.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from lamindb_setup.core._settings_storage import get_storage_region
from lamindb_setup.core.upath import LocalPathClasses, create_path
from lnschema_core import Artifact, Run
from packaging import version

if TYPE_CHECKING:
from lamindb_setup.core.types import UPathStr
Expand Down Expand Up @@ -182,14 +183,28 @@ def save_tiledbsoma_experiment(
context=ctx,
)

resize_experiment = False
if registration_mapping is not None:
n_observations = len(registration_mapping.obs_axis.data)
if version.parse(soma.__version__) < version.parse("1.15.0rc4"):
n_observations = len(registration_mapping.obs_axis.data)
else:
n_observations = registration_mapping.get_obs_shape()
resize_experiment = True
else: # happens only if not appending and only one adata passed
assert len(adata_objects) == 1 # noqa: S101
n_observations = adata_objects[0].n_obs

logger.important(f"Writing the tiledbsoma store to {storepath}")
for adata_obj in adata_objects:
if resize_experiment and soma.Experiment.exists(storepath, context=ctx):
# can only happen if registration_mapping is not None
soma_io.resize_experiment(
storepath,
nobs=n_observations,
nvars=registration_mapping.get_var_shapes(),
context=ctx,
)
resize_experiment = False
soma_io.from_anndata(
storepath,
adata_obj,
Expand Down
15 changes: 8 additions & 7 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,16 @@ def install_ci(session, group):
# testing load_to_memory for yaml
run(session, "uv pip install --system PyYAML")
run(session, "uv pip install --system huggingface_hub")
# pinning 1.15.0rc3 because 1.14.5 is incompatible with anndata>=0.11.0
# and >1.15.0rc4 has a different append mode API
# wating for a normal release to adapt
run(
session, "uv pip install --system tiledbsoma==1.15.0rc3"
) # test SOMACurator
# tiledbsoma dependency, specifying it here explicitly
# otherwise there are problems with uv resolver
run(session, "uv pip install --system scanpy")
run(session, "uv pip install --system tiledbsoma") # test SOMACurator
elif group == "unit-storage":
extras += "zarr,bionty"
run(session, "uv pip install --system tiledbsoma==1.15.0rc3")
# tiledbsoma dependency, specifying it here explicitly
# otherwise there are problems with uv resolver
run(session, "uv pip install --system scanpy")
run(session, "uv pip install --system tiledbsoma")
elif group == "tutorial":
extras += "jupyter,bionty"
run(session, "uv pip install --system huggingface_hub")
Expand Down
Loading