getBanksyMatrix: Builds the BANKSY matrix from neighborhood matrices.

View source: R/computation.R

getBanksyMatrixR Documentation

Builds the BANKSY matrix from neighborhood matrices.

Description

Builds the BANKSY matrix from neighborhood matrices.

Usage

getBanksyMatrix(
  se,
  M,
  lambda,
  assay_name = NULL,
  scale = FALSE,
  group = NULL,
  verbose = TRUE
)

Arguments

se

A SpatialExperiment, SingleCellExperiment or SummarizedExperiment object with computeBanksy ran.

M

A integer scalar specifying the highest azimuthal Fourier harmonic to compute.

lambda

A numeric vector in \in [0,1] specifying a spatial weighting parameter. Larger values (e.g. 0.8) incorporate more spatial neighborhood and find spatial domains, while smaller values (e.g. 0.2) perform spatial cell-typing.

assay_name

A string scalar specifying the name of the assay used in computeBanksy.

scale

A logical scalar specifying whether to scale the features to zero mean and unit standard deviation. This is performed before multiplying the assays by their corresponding lambda weighting factors.

group

A string scalar specifying a grouping variable for samples in se. This is used to scale the samples in each group separately.

verbose

A logical scalar specifying verbosity.

Details

After computation of the neighborhood matrices (see computeBanksy), this function builds the BANKSY matrix by concatenating the original expression matrix with the neighborhood matrices, and scales each matrix by an appropriate weight as determined by lambda. The weights of the own expression matrix, mean neighborhood matrix and azimuthal Gabor filter are given by \sqrt{1-\lambda}, \sqrt{\lambda/\mu} and \sqrt{\lambda/2\mu} respectively, where \mu=1.5. In the case where the AGF is not computed, the weights for the own and mean neighborhood expression matrix simplify to \sqrt{1-\lambda} and \sqrt{\lambda} respectively.

Value

BANKSY matrix.

Examples

data(rings)
spe <- computeBanksy(rings, assay_name = "counts", M = 1, k_geom = c(15, 30))
banksyMatrix <- getBanksyMatrix(spe, M = 1, lambda = 0.2)


prabhakarlab/Banksy documentation built on April 11, 2024, 2:45 p.m.