bbknn

Batch balanced kNN [Polanski19] alters the kNN procedure to identify each cell's top neighbours in each batch separately instead of the entire cell pool with no accounting for batch. The nearest neighbours for each batch are then merged to create a final list of neighbours for the cell. Aligns batches in a quick and lightweight manner.

Parameters

batch_key: str Provide a batch key for BBKNN.


Web view

bbknn_screenshot

Python equivalent

!pip install bbknn # install external libraries
import scanpy as sc

sc.tl.pca(adata)
sc.external.pp.bbknn(adata, batch_key='BATCH')