Skip to contents

The function CreateNeighbors is used to calculate adjacency matrix form spatial coordinates.

Usage

CreateNeighbors(
  obj,
  platform = c("Other", "ST", "Visium"),
  lower.med = 4,
  upper.med = 6,
  radius.upper = 100
)

# S3 method for iSCMEBObj
CreateNeighbors(
  obj,
  platform = c("Other", "ST", "Visium"),
  lower.med = 4,
  upper.med = 6,
  radius.upper = 100
)

# S3 method for list
CreateNeighbors(
  obj,
  platform = c("Other", "ST", "Visium"),
  lower.med = 4,
  upper.med = 6,
  radius.upper = 100
)

Arguments

obj

A seuList or iSCMEBObj object or posList.

platform

A string, specify the platform of the provided data, default as "Other", and only support "ST" and "Visium" platform. When platform is specified as "Other", adjacency matrix will built based on L2 distance.

lower.med

An option parameter determine the lower bound of median of number of neighborhoods. Should be provided when platform is specified as "Other".

upper.med

An option parameter determine the upper bound of median of number of neighborhoods. Should be provided when platform is specified as "Other".

radius.upper

An option parameter determine the search radius upper bound of neighborhoods. Should be provided when platform is specified as "Other".

Value

Returns a revised iSCMEBObj object.

Returns a revised list.

Details

seuList is a list with Seurat object as component, and each Seurat object includes the raw expression count matrix, spatial coordinates and meta data for each data batch, where the spatial coordinates information must be saved in the metadata of Seurat, named "row" and "col" for each data batch. posList is a list of position information, each element of which can be a data.frame or matrix. When the element of posList is data.frame, those data.frame should contain columns with names "row" and "col". When the element of posList is matrix, those matrices should be two column matrices.

See also

Examples

data(iSCMEBObj_toy)
#> Warning: data set 'iSCMEBObj_toy' not found
library(Seurat)
iSCMEBObj_toy2 <- CreateNeighbors(iSCMEBObj_toy, platform = "Visium")
#> Neighbors were identified for 4222 out of 4222 spots.
#> Neighbors were identified for 4378 out of 4381 spots.
## iSCMEBObj_toy2 <- CreateNeighbors(iSCMEBObj_toy, radius.upper = 10)