snapatac2.pp.mnc_correct#

snapatac2.pp.mnc_correct(adata, batch, n_neighbors=5, n_clusters=40, use_dims=None, use_rep='X_spectral', n_iter=1, inplace=True)[source]#

A modified MNN-Correct algorithm based on cluster centroid.

Parameters
  • data – Matrice or AnnData object. Matrices should be shaped like n_obs x n_vars.

  • batch – Batch labels for cells. If a string, labels will be obtained from obs.

  • n_neighbors – Number of mutual nearest neighbors.

  • n_clusters – Number of clusters

  • use_dims – Use these dimensions in use_rep.

  • use_rep – Use the indicated representation in .obsm.

  • n_iter – Number of iterations.

  • inplace – Whether to store the result in the anndata object.

Returns

if inplace=True it updates adata with the field adata.obsm[`use_rep`_mnn], containing adjusted principal components. Otherwise, it returns the result as a numpy array.

Return type

np.ndarray | None