From a metadata file, given a list of cells with the corrisponding annotated cell type, build a neighbor matrix reporting the number of occurrences for each cell type
nnMat(
data,
method = c("Q", "K", "C", "M"),
snap = NULL,
k = NULL,
d.max = NULL,
label = "final_anno",
ids_anno = NULL,
return.seurat = T
)
a Seurat object containing Kandinsky data
character string specifying the method to be used to identify neighbours. Must be one of the following: 'Q': queen contiguity method,check for contact (not overlap) between any edge or side od two polygons (refers to the queen movement rule in chess). Currently only applicable for Visium/Visium-HD data 'C': centroid-based method, use maximum centroid distance threshold to identify spot/cell neighbours 'K': KNN method, define k closest neighbours to each spot/cell 'M': membrane-based method, check for the occurrence of a physical contact/intersection within a distance threshold between cell boundaries. Not applicable in the case of Visium spots. When argument `method` is not specified or is set to `NULL`, the function will use `nb` slot already stored in Kandinsky object to create neighbour matrix
numeric, extra distance accepted between polygon borders for contiguity relation. Applied when 'method' is set to `Q`. Can't work with point geometries like cell centroids.
numeric, number of nearest neighbours to be searched. Applied when `method` is set to `K`
numeric, maximum centroid or membrane distance threshold. Applied when `method` is set to `C` or `M`
character string specifying the variable name to be used to defne cell annotation groups
optional, character string specifying any extra variable to be added to the final distance matrix
boolean, whether returning neighbour matrix alone (FALSE) or the input Seurat object with a new `nnMat` slot as part of the Kandinsky data
Other nnMat:
nn_query()