spatialtis.find_neighbors¶
- class 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
R-tree is used when cells are polygons
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
data (anndata._core.anndata.AnnData) – AnnData object to perform analysis
method (Optional[str]) – “kdtree”, “rtree” and “delaunay”, Default: “kdtree”
r (Optional[float]) – The search radius
k (Optional[int]) – The (minimum) number of nearest-neighbors
scale (Optional[Union[int, float]]) – How much to scale each cell, only if cell has shape
export_key (str) – The key used to store result
**kwargs – Pass to
spatialtis.abc.AnalysisBase