Construct a distance-based neighbour list from cell coordinates.
Source:R/findNbrsSpatial.R
findNbrsSpatial.Rd
Construct a distance-based neighbour list from cell coordinates.
Arguments
- spe
A SpatialExperiment object.
- k
Integer scalar for number of nearest neighbours to find. Can be used with radius. See details.
- radius
Numeric for maximum distance to search for neighbours. Can be with k. See details
- dist_func
Options for distance-based weight. "idw" for inverse distance, "exp" for exponential decay, "binary" for constant weight, and "none" for raw euclidean distance.
- standardisation
Options for weight standardisation. "none" for nothing, and "row" for dividing weights by number of neighbours.
- scale
Numeric scaler for weight scaling.
- nbrs_name
Name of the neighbour list to be stored. Default to be "spatial".
- cpu_threads
Number of cpu threads for parallel computation.
Details
if only k
is provided, neighbours are found using
findKNN. If only radius
is provided, neighbours are
found using findNeighbors. If both are provided, then
knn is done first then neighbours are filtered to only those within radius.
Examples
data("xenium_bc_spe")
spe <- findNbrsSpatial(spe,k=20,radius=100)