anndata.experimental.write_dispatched

anndata.experimental.write_dispatched#

anndata.experimental.write_dispatched(store, key, elem, callback, *, dataset_kwargs=mappingproxy({}))[source]#

Write elem to store, recursively calling callback at each sub-element.

Parameters:
store Union[Group, Group]

Storage container to be written to.

key str

Key to write element to. To write to the root group, use “/”.

elem Any

The element to write. Probably an AnnData.

callback Callable[[Callable[[Union[Array, Dataset, Group, Group], str, Any], None], Union[Group, Group], str, Any, dict], None]

Function called when writing each element. See below for signature.

dataset_kwargs Mapping[str, Any] (default: mappingproxy({}))

Keyword arguments to pass to the dataset creation function.

Return type:

None

The callback has the following signature:

  • write_func (Callable): A callable which takes the in memory element and writes it to the store. This is the default encoding function, and what to call if you don’t want to change behaviour at this level.

  • store (GroupStorageType): The store to write to.

  • key (str): The key to write elem into store at. This will be an absolute key.

  • elem (Any): The element to write.

  • dataset_kwargs (dict): Keyword arguments to pass to the dataset creation function. This is passed as a keyword argument.

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