static CondSCVI.setup_anndata(adata, labels_key, layer=None, copy=False)[source]

Sets up the AnnData object for this model. A mapping will be created between data fields used by this model to their respective locations in adata.

None of the data in adata are modified. Only adds fields to adata.

adata : AnnDataAnnData

AnnData object containing raw counts. Rows represent cells, columns represent features.

labels_key : strstr

key in adata.obs for label information. Categories will automatically be converted into integer categories and saved to adata.obs[‘_scvi_labels’]. If None, assigns the same label to all the data.

layer : str | NoneOptional[str] (default: None)

if not None, uses this as the key in adata.layers for raw count data.

copy : boolbool (default: False)

if True, a copy of adata is returned.

Return type

AnnData | NoneOptional[AnnData]


If copy, will return AnnData. Adds the following fields to adata:


scvi setup dictionary


labels encoded as integers


batch encoded as integers