Calculate the adjacency matrix for the spatial transcriptomics data measured on 10X Visium, ST or other platforms as a Seurat object.

# S3 method for Seurat
getAdj(obj, platform = c('Visium', "ST", "Other_SRT"), ...)

Arguments

obj

an object with class "Seurat", there are spatial coordinates information in the metadata of obj, named "row" and "col", where first column is x-axis coordinate, the second column is y-axis coordinate. getAdj_manual and getAdj_auto supports multi-dimensional spatial coordinates with a matrix as input.

platform

a string, specify the platform of the provided data, default as "Visium". There are more platforms to be chosen, including ("Visuim", "ST", "Other_SRT"), which means there are spatial coordinates information in the metadata of obj, named "row" and "col". The platform helps to calculate the adjacency matrix by defining the neighborhoods.

...

Other arguments to pass into getAdj_auto function.

Details

For lattice grids in ST platform (ST), the interior spot has four neighbors (left, right, up and down),the boundary spot has three neighbors, and the spot in the corner has two neighbors. For hexagon grids, such as spatial coordinate in 10X Visium platform (Visium), the interior spot has six neighbors. For the irregular coordinates in other platforms (Other_SRT), Euclidean distance is adopted to decide whether a spot is an neighbor of another spot. For example, if the Euclidean distance between spot A and B is less than a radius, then A is taken as the neighbourhood of B. See functions getAdj_auto and getAdj_manual for more details.

Value

Return a dgCMatrix object recording the information of neighborhoods about each spot.

Author

Wei Liu

Note

nothing

Examples

  ## S3 method for class "Seurat"
  seu <- gendata_RNAExp(height=20, width=20,p=200, K=4)
  Adj_sp <- getAdj(seu, platform = 'ST')
#> Neighbors were identified for 400 out of 400 spots.