Input/Output

Input/Output#

To read the data from a specific technology (e.g., Xenium, MERSCOPE, …), you can use any of the spatialdata-io readers.

spatialdata.read_zarr(store, selection=None, on_bad_files=BadFileHandleMethod.ERROR)#

Read a SpatialData dataset from a zarr store (on-disk or remote).

Parameters:
  • store (str | Path | UPath | Group) – Path, URL, or zarr.Group to the zarr store (on-disk or remote).

  • selection (None | tuple[str] (default: None)) – List of elements to read from the zarr store (images, labels, points, shapes, table). If None, all elements are read.

  • on_bad_files (Literal[ERROR, WARN] (default: <BadFileHandleMethod.ERROR: 'error'>)) –

    Specifies what to do upon encountering a bad file, e.g. corrupted, invalid or missing files. Allowed values are :

    • ’error’, raise an exception when a bad file is encountered. Reading aborts immediately with an error.

    • ’warn’, raise a warning when a bad file is encountered and skip that file. A SpatialData object is returned containing only elements that could be read. Failures can only be determined from the warnings.

Return type:

SpatialData

Returns:

: A SpatialData object.

spatialdata.get_dask_backing_files(element)#
spatialdata.get_dask_backing_files(element)
spatialdata.get_dask_backing_files(element)
spatialdata.get_dask_backing_files(element)
spatialdata.get_dask_backing_files(element)
spatialdata.get_dask_backing_files(element)
spatialdata.get_dask_backing_files(element)

Get the backing files that appear in the Dask computational graph of an element/any element of a SpatialData object.

Parameters:

element (SpatialData | DataArray | DataTree | GeoDataFrame | DataFrame | AnnData) – The element to get the backing files from.

Return type:

list[str]

Returns:

: List of backing files.

Notes

It is possible for lazy objects to be constructed from multiple files.