omicverse.single.Batch

omicverse.single.Batch(adata, batch_key='batch', scale=True, embedding=True, seed=0, dimred_func=None, rep_name='X_pca', **kwargs)[source]

Run MultiMAP to correct batch effect within a single AnnData object. Loses the flexibility of individualised dimensionality reduction choices, but doesn’t require a list of separate objects for each batch/dataset to integrate. Runs PCA on a per-batch/dataset basis prior to performing an analysis analogous to Integration(). Adds appropriate .obsp graphs and .obsm['X_multimap'] (if instructed) to the input.

Input

adataAnnData

The object to process. .X data will be used in the computation.

batch_keystr, optional (default: “batch”)

The .obs column of the input object with the categorical variable defining the batch/dataset grouping to integrate on.

scalebool, optional (default: True)

Whether to scale the data to N(0,1) on a per-dataset basis prior to computing the cross-dataset PCAs. Improves integration.

embeddingbool, optional (default: True)

Whether to compute the MultiMAP embedding. If False, will just return the graph, which can be used to compute a regular UMAP. This can produce a manifold quicker, but at the cost of accuracy.

dimred_funcfunction or None, optional (default: None)

The function to use to compute dimensionality reduction on a per-dataset basis. Must accept an AnnData on input and modify it by inserting its dimensionality reduction into .obsm. If None, scanpy.tl.pca() will be used.

rep_namestr, optional (default: “X_pca”)

The .obsm field that the dimensionality reduction function stores its output under.

All other arguments as described in Integration().