from_url#

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

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

Download and load an .h5ad dataset from a direct HTTP(S) URL.

Parameters:
  • url (str) – Direct URL to a downloadable .h5ad file.

  • name (str, optional) – Name for the cached file (without extension). If omitted, the cache filename is derived from the URL’s last path segment.

  • 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 name is not given and no filename can be derived from url.

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

Notes

Generic loader for any host that serves an AnnData .h5ad file at a stable URL (CELLxGENE, Zenodo, Figshare, S3 buckets, etc.).