spatialtis.find_neighbors#
- spatialtis.find_neighbors(data, method='kdtree', r=None, k=None, scale=None, export_key=None, **kwargs)[source]#
To find the neighbors of each cell.
KD-tree and Delaunay triangulation are used when cells are points, by default search for k=5.
R-tree is used when cells are polygons, by default search for scale=1.4.
Note
When
method="kdtree"
, you can search neighbors within radius and/or by nearest-neighbors. If you specificr=30, k=5
, this will search within 30 while limited the number of neighbors to 5.- Parameters
- dataAnnData
The AnnData to work with.
- method{‘kdtree’, ‘rtree’, ‘delaunay’}, default: ‘kdtree’
- rfloat
The search radius.
- kfloat
The (minimum) number of nearest-neighbors.
- scalefloat
How much to scale each cell, only if cell has shape.
- export_keystr
The key used to store result.
- **kwargs
Config for the analysis, for details check
spatialtis.abc.AnalysisBase
.