API#

The central class:

AnnData([X, obs, var, uns, obsm, varm, ...])

An annotated data matrix.

Combining#

Combining AnnData objects. See also the section on concatenation.

concat(adatas, *[, axis, join, merge, ...])

Concatenates AnnData objects along an axis.

Reading#

Reading anndata’s native file format .h5ad.

read_h5ad(filename[, backed, as_sparse, ...])

Read .h5ad-formatted hdf5 file.

Reading other file formats.

read_csv(filename[, delimiter, ...])

Read .csv file.

read_excel(filename, sheet[, dtype])

Read .xlsx (Excel) file.

read_hdf(filename, key)

Read .h5 (hdf5) file.

read_loom(filename, *[, sparse, cleanup, ...])

Read .loom-formatted hdf5 file.

read_mtx(filename[, dtype])

Read .mtx file.

read_text(filename[, delimiter, ...])

Read .txt, .tab, .data (text) file.

read_umi_tools(filename[, dtype])

Read a gzipped condensed count matrix from umi_tools.

read_zarr(store)

Read from a hierarchical Zarr array store.

Writing#

Writing to anndata’s native file format .h5ad.

AnnData.write([filename, compression, ...])

Write .h5ad-formatted hdf5 file.

Writing to other formats.

AnnData.write_csvs(dirname[, skip_data, sep])

Write annotation to .csv files.

AnnData.write_loom(filename[, write_obsm_varm])

Write .loom-formatted hdf5 file.

AnnData.write_zarr(store[, chunks])

Write a hierarchical Zarr array store.

Experimental API#

Warning

API’s in the experimental module are currently in development and subject to change at any time.

Two classes for working with batched access to collections of many AnnData objects or h5ad files. In paritcular, for pytorch-based models.

experimental.AnnCollection(adatas[, ...])

Lazily concatenate AnnData objects along the obs axis.

experimental.AnnLoader(adatas[, batch_size, ...])

PyTorch DataLoader for AnnData objects.

Interface for accessing on-disk sparse data:

experimental.sparse_dataset(group)

Generates a backed mode-compatible sparse dataset class.

experimental.CSRDataset(group)

On disk CSR sparse matrix.

experimental.CSCDataset(group)

On disk CSC sparse matrix.

Out of core concatenation

experimental.concat_on_disk(in_files, ...[, ...])

Concatenates multiple AnnData objects along a specified axis using their corresponding stores or paths, and writes the resulting AnnData object to a target location on disk.

Low level methods for reading and writing elements of an AnnData` object to a store:

experimental.read_elem(elem)

Read an element from a store.

experimental.write_elem(store, k, elem, *[, ...])

Write an element to a storage group using anndata encoding.

Utilities for customizing the IO process:

experimental.read_dispatched(elem, callback)

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

experimental.write_dispatched(store, key, ...)

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

experimental.IOSpec(encoding_type, ...)

Errors and warnings#

ImplicitModificationWarning

Raised whenever initializing an object or assigning a property changes the type of a part of a parameter or the value being assigned.

Settings#

settings

This manager allows users to customize settings for the anndata package.

settings.override(**overrides)

Provides local override via keyword arguments as a context manager.