omicverse.single.batch_correction

omicverse.single.batch_correction(adata, batch_key, use_rep='scaled|original|X_pca', methods='harmony', n_pcs=50, **kwargs)[source]

Run batch-effect correction for single-cell data integration.

Parameters:
  • adata (anndata.AnnData) – Input data matrix. Different methods require different preprocessing: for example, scVI typically needs raw counts in adata.layers['counts'].

  • batch_key (str) – Column in adata.obs defining batch/domain labels.

  • use_rep (str, default='scaled|original|X_pca') – Embedding key used by embedding-based methods (for example Harmony).

  • methods (str, default='harmony') – Integration backend. Supported values include 'harmony', 'combat', 'scanorama', 'scVI', 'CellANOVA', and 'Concord'.

  • n_pcs (int, default=50) – Number of principal components used when recomputing embeddings.

  • **kwargs – Additional method-specific keyword arguments passed to the selected backend implementation.

Returns:

Returns adata for most methods, scVI model object for 'scVI', and Concord object for 'Concord'. The integrated embeddings are written to adata.obsm.

Return type:

anndata.AnnData or object