decoupler.pp.knn#

decoupler.pp.knn(adata, key='spatial', bw=100, max_nn=100, cutoff=0.1)#

Adds K-Nearest Neighbors similarities based on spatial distances.

Parameters:
adata AnnData

Annotated data matrix with observations (rows) and features (columns).

key str (default: 'spatial')

adata.obsm key to use.

bw float (default: 100)

Bandwith of kernel.

max_nn int (default: 100)

Maximum number of nearest neighbors to consider.

cutoff float (default: 0.1)

Values below this number are set to zero.

Return type:

None

Example

import decoupler as dc

adata = dc.ds.msvisium()
dc.pp.knn(adata, key="spatial", bw=100, cutoff=0.1)