from_cellxgene#

API pages include interactive (HTML) plots that would possibly not render correctly on a mobile device.

from_cellxgene(source: str, *, name: str | None = None, cache_directory: str | Path | PathLike = _GLOBAL_CACHE, use_cache: bool = True, bring: bool = True) AnnData#

Download and load a dataset from CELLxGENE by URL or UUID.

Parameters:
  • source (str) – A CELLxGENE dataset UUID (e.g. 7cdea341-ca7a-40fd-8192-b8ecb2d7b91e) or a full .h5ad URL (e.g. https://datasets.cellxgene.cziscience.com/<uuid>.h5ad).

  • name (str, optional) – Name for the cached file (without extension). Defaults to the dataset UUID parsed from source.

  • cache_directory (str | Path | PathLike) – Directory where the .h5ad file is cached.

  • use_cache (bool, default True) – If True, load from the cached file when present. If False, remove any existing cached file and regenerate from scratch.

  • bring (bool, default True) – If True and cache_directory is not the default global cache, copy the file from the global cache when it already exists there. Set to False to disable this behavior.

Returns:

AnnData – The downloaded dataset.

Raises:
  • ValueError – If source is neither a CELLxGENE dataset UUID nor a URL containing one.

  • OSError – If the downloaded file size does not match the expected size.

Notes

Thin wrapper around from_url that accepts a CELLxGENE dataset UUID directly and constructs the canonical download URL.