snapatac2.pp.harmony#
- snapatac2.pp.harmony(adata, batch, use_dims=None, use_rep='X_spectral', inplace=True, **kwargs)[source]#
Use harmonypy to integrate different experiments.
Harmony is an algorithm for integrating single-cell data from multiple experiments. This function uses the python port of Harmony,
harmonypy
, to integrate single-cell data stored in an AnnData object. This function should be run after performing dimension reduction.- Parameters
adata (
AnnData
|AnnDataSet
|ndarray
) – The (annotated) data matrix of shapen_obs
xn_vars
. Rows correspond to cells and columns to regions.batch (
str
) – The name of the column inadata.obs
that differentiates among experiments/batches.use_dims (
Union
[int
,list
[int
],None
]) – Use these dimensions inuse_rep
.use_rep (
str
) – The name of the field inadata.obsm
where the lower dimensional representation is stored.inplace (
bool
) – Whether to store the result in the anndata object.kwargs – Any additional arguments will be passed to
harmonypy.run_harmony()
.
- Returns
if
inplace=True
it updates adata with the fieldadata.obsm[`use_rep`_harmony]
, containing principal components adjusted by Harmony such that different experiments are integrated. Otherwise, it returns the result as a numpy array.- Return type
np.ndarray | None