Skip to content

Commit 602294e

Browse files
committed
changes for issue288
1 parent 4cf0f63 commit 602294e

3 files changed

Lines changed: 4 additions & 142 deletions

File tree

src/spatialdata_io/readers/_utils/_read_10x_h5.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

src/spatialdata_io/readers/_utils/_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import os
4+
import scanpy as sc
45
from collections.abc import Mapping
56
from pathlib import Path
67
from typing import Any, Union
@@ -11,8 +12,6 @@
1112
from ome_types.model import Pixels, UnitsLength
1213
from spatialdata._logging import logger
1314

14-
from spatialdata_io.readers._utils._read_10x_h5 import _read_10x_h5
15-
1615
PathLike = Union[os.PathLike, str] # type:ignore[type-arg]
1716

1817

@@ -24,7 +23,7 @@ def _read_counts(
2423
) -> tuple[AnnData, str]:
2524
path = Path(path)
2625
if counts_file.endswith(".h5"):
27-
adata: AnnData = _read_10x_h5(path / counts_file, **kwargs)
26+
adata: AnnData = sc.read_10x_h5(path / counts_file, **kwargs)
2827
with File(path / counts_file, mode="r") as f:
2928
attrs = dict(f.attrs)
3029
if library_id is None:

src/spatialdata_io/readers/xenium.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import pyarrow.parquet as pq
2020
import tifffile
2121
import zarr
22+
import scanpy as sc
2223
from anndata import AnnData
2324
from dask.dataframe import read_parquet
2425
from dask_image.imread import imread
@@ -42,7 +43,6 @@
4243
from spatialdata_io._constants._constants import XeniumKeys
4344
from spatialdata_io._docs import inject_docs
4445
from spatialdata_io._utils import deprecation_alias
45-
from spatialdata_io.readers._utils._read_10x_h5 import _read_10x_h5
4646
from spatialdata_io.readers._utils._utils import _initialize_raster_models_kwargs
4747

4848
__all__ = ["xenium", "xenium_aligned_image", "xenium_explorer_selection"]
@@ -520,7 +520,7 @@ def _get_points(path: Path, specs: dict[str, Any]) -> Table:
520520
def _get_tables_and_circles(
521521
path: Path, cells_as_circles: bool, specs: dict[str, Any]
522522
) -> AnnData | tuple[AnnData, AnnData]:
523-
adata = _read_10x_h5(path / XeniumKeys.CELL_FEATURE_MATRIX_FILE)
523+
adata = sc.read_10x_h5(path / XeniumKeys.CELL_FEATURE_MATRIX_FILE)
524524
metadata = pd.read_parquet(path / XeniumKeys.CELL_METADATA_FILE)
525525
np.testing.assert_array_equal(metadata.cell_id.astype(str), adata.obs_names.values)
526526
circ = metadata[[XeniumKeys.CELL_X, XeniumKeys.CELL_Y]].to_numpy()

0 commit comments

Comments
 (0)