scpdac.tl.embed_and_predict#
- scpdac.tl.embed_and_predict(adata, species, *, layer='counts', batch_key='Sample_ID')#
Embed a query dataset with a packaged SCANVI model and predict cell types.
This is the lightweight, no-surgery path: it assumes the query batches are compatible with the reference model registry. Use
extend_atlas()when the query introduces new batches.- Parameters:
adata (
AnnData) – Query data. Must contain raw counts inadata.layers[layer]and abatch_keycolumn inadata.obs.species (
str) –"human"or"mouse"— selects the packaged model and gene panel.layer (
str(default:'counts')) – Layer holding raw counts to bin before inference.batch_key (
str(default:'Sample_ID')) – Column inadata.obsidentifying the batch covariate.
- Return type:
- Returns:
The input
adatawith the latent embedding inadata.obsm["X_scANVI_emb"]and predicted labels inadata.obs["predicted_celltype"].- Raises:
ValueError – If
batch_keyis absent fromadata.obs.