scatlastb_utils.io.read_slot

Contents

scatlastb_utils.io.read_slot#

scatlastb_utils.io.read_slot(file, group, slot_name, force_sparse_types=None, force_slot_sparse=False, backed=False, dask=False, chunks=None, stride=1000, fail_on_missing=True, verbose=True, debug=False)#

Read a specific slot from a zarr or h5py group.

Parameters:
  • file (str | Path) – Path to the zarr or h5ad file.

  • group (Group | Group | None) – File group to read from.

  • slot_name (str) – Name of the slot to read.

  • force_sparse_types (str | list[str] | None (default: None)) – Encoding types to convert to sparse_dataset via csr_matrix. Default is None.

  • force_slot_sparse (bool (default: False)) – Whether to force the slot to be read as sparse. Default is False.

  • backed (bool (default: False)) – Whether to read sparse matrix as sparse_dataset. Default is False.

  • dask (bool (default: False)) – Whether to read any matrix as dask array. Default is False.

  • chunks (int | tuple | None (default: None)) – Chunks parameter for creating dask array. Default is None.

  • stride (int (default: 1000)) – Stride parameter for creating backed dask array. Default is 1000.

  • fail_on_missing (bool (default: True)) – Whether to raise an error if the slot is not found. Default is True.

  • verbose (bool (default: True)) – Whether to print verbose output. Default is True.

  • debug (bool (default: False)) – Whether to enable debug mode. Default is False.

Return type:

Any

Returns:

slot The read slot as an AnnData object or a dask array.

Raises:

ValueError – If the slot is not found and fail_on_missing is True.