get.neighbors: Get Neighborhood Information

View source: R/neighbors.R

get.neighborsR Documentation

Get Neighborhood Information

Description

Obtain a long format of the adjacency matrix, specifically, for the geospatial profile of the spatial transcriptomics (ST) data.

Usage

get.neighbors(spots, n.neighbors, method = c("distance", "KNN"))

Arguments

spots

An n-by-2 numeric matrix T to represent the geospatial profile, where each row indicates the spot location in the grid.

n.neighbors

An integer value that denotes the number of neighbors or connectivity. See "Details" for more information.

method

An optional character string that specifies the method to obtain the neighboring spots. The default is "distance" to set a cutoff value.

Details

Generally, for 10X and ST data, the number of neighbors are 6 and 4, respectively. These values represent how the spots are arranged in a lattice. For example, 6 and 4 indicate a hexagonal and square tiling, respectively.

The neighboring spots are obtained by two possible methods, where the neighbors are obtained via a (1) distance threshold, which sets a cutoff value, or the (2) k-nearest neighbors algorithm, which chooses the closest neighbors in distance. Additionally, for method (1), a spot might not have a full connectivity.

See Jiang et al. (2021) for an introduction to the lattice grid system.

Value

A numeric matrix that denotes the long format of the adjacency matrix. Each entry denotes the neighbor for spot i. If a spot does not have full connectivity, then the latest entry or entries are zero.

References

Jiang, X., Li, Q., & Xiao, G. (2021). Bayesian Modeling of Spatial Transcriptomics Data via a Modified Ising Model. arXiv preprint arXiv:2104.13957.

See Also

st.plot() for plotting the expression levels and, hence, the lattice grid.


estfernan/boost documentation built on June 24, 2022, 12:20 a.m.