stereo.io.read_h5ad#

stereo.io.read_h5ad(file_path=None, anndata=None, flavor='scanpy', bin_type=None, bin_size=None, **kwargs)[source]#

Read a h5ad file or load a AnnData object

Parameters:
  • file_path (Optional[str]) – the path of the h5ad file.

  • anndata (Optional[AnnData]) – the object of AnnData which to be loaded, only available while flavor is 'scanpy'. file_path and anndata only can input one of them.

  • flavor (str) – the format of the h5ad file, defaults to 'scanpy'. scanpy: AnnData format of scanpy stereopy: h5ad format of stereo

  • bin_type (Optional[str]) – the bin type includes 'bins' or 'cell_bins'.

  • bin_size (Optional[int]) – the size of bin to merge, when bin_type is set to 'bins'.

Return type:

Union[StereoExpData, AnnBasedStereoExpData]

Returns:

  • An object of StereoExpData while flavor is 'stereopy' or an object of AnnBasedStereoExpData while flavor is

  • 'scanpy'