anndata.experimental.read_dispatched(elem, callback)[source]#

Read elem, calling the callback at each sub-element.

elem Array | Dataset | Group | GroupUnion[Array, Dataset, Group, Group]

Storage container (e.g. h5py.Group, zarr.Group). This must have anndata element specifications.

callback ((Array | Dataset | Group | Group) → Any, str, Array | Dataset | Group | Group, IOSpec) → AnyCallable[[Callable[[Union[Array, Dataset, Group, Group]], Any], str, Union[Array, Dataset, Group, Group], IOSpec], Any]

Function to call at each anndata encoded element. See details below for signature.

Return type:


The callback has the following signature:

  • read_func (Callable): A callable which takes the encoded element and returns it’s decoded value. This is the default decoding function, and what to call if you don’t want to modify the decoding. It will call this callback again at the next element encoding it sees.

  • key (str): They absolute key of the element in the store. This will be an absolute key.

  • elem (StorageType): The encoded element.

  • iospec (IOSpec): The specification of the element. This is passed as a keyword argument.