Python API

An API to facilitate use of the CZI Science CELLxGENE Census. The Census is a versioned container of single-cell data hosted at CELLxGENE Discover.

The API is built on the tiledbsoma SOMA API, and provides a number of helper functions including:

  • Open a named version of the Census, for use with the SOMA API

  • Get a list of available Census versions, and for each version, a description

  • Get a slice of the Census as an AnnData, for use with ScanPy

  • Get the URI for, or directly download, underlying data in H5AD format

For more information on the API, visit the cellxgene_census repo. For more information on SOMA, see the tiledbsoma repo.

Open/retrieve Cell Census data


Open the Census by version or URI.


Open the named version of the census, and return the URI for the dataset_id.


Download the source H5AD dataset, for the given dataset_id, to the user-specified file name.

Get slice as AnnData


Convience wrapper around soma.Experiment query, to build and execute a query, and return it as an anndata.AnnData object.

Feature presence matrix


Read the feature dataset presence matrix and return as a SciPy sparse CSR array.

Versioning of Cell Census builds


Get release description for given Census version, from the Census release directory.


Get the directory of Census versions currently available, optionally filtering by specified flags.

Experimental: Machine Learning

Factory method for PyTorch DataLoader.

An iterable-style PyTorch DataPipe that reads obs and X data from a SOMA Experiment, based upon the specified queries along the obs and var axes.

Statistics about the data retrieved by ExperimentDataPipe via SOMA API.

Experimental: Processing


Convenience wrapper


Identify and annotate highly variable genes contained in the query results.


Calculate mean and/or variance along the obs axis from query results.

Experimental: Utility


NOTE: this API is deprecated as of version 1.8, and will be removed in version 1.9.