cellpin.pp.setup_data

Contents

cellpin.pp.setup_data#

cellpin.pp.setup_data(sc_adata, st_adata, gene_symbols=None, layer=None, batch_key=None, table_key='table')#

Prepare aligned single-cell and spatial datasets for cellpin.

Return type:

tuple[scAnnDataset, stAnnDataset]

Args:
sc_adata: Reference scRNA-seq AnnData. Its gene space becomes the

imputation target.

st_adata: Spatial AnnData (or SpatialData). Its genes define the panel. gene_symbols: Name of a var column holding alternative gene

identifiers (e.g. human-readable symbols when var_names are Ensembl IDs). When None, var_names are used directly.

layer: Expression layer to read. Must contain raw counts (non-negative

integers) — required by the NB/ZINB generative model. When None, .X is used.

batch_key: obs column in sc_adata for batch conditioning. When

None, batch correction is disabled.

table_key: Only relevant when st_adata is a SpatialData object;

specifies which table to read from sdata.tables.

Returns:

Tuple of (scAnnDataset, stAnnDataset) — aligned datasets ready to pass to CellPin.

Raises:
ValueError: If gene names contain duplicates, no overlapping genes are

found, or internal alignment invariants are violated.