Builds the BANKSY matrix from neighborhood matrices.
getBanksyMatrix(
se,
M,
lambda,
assay_name = NULL,
scale = FALSE,
group = NULL,
verbose = TRUE
)
A SpatialExperiment
,
SingleCellExperiment
or SummarizedExperiment
object with computeBanksy
ran.
A integer scalar specifying the highest azimuthal Fourier harmonic to compute.
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.
A string scalar specifying the name of the assay used in
computeBanksy
.
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.
A string scalar specifying a grouping variable for samples in
se
. This is used to scale the samples in each group separately.
A logical scalar specifying verbosity.
BANKSY matrix.
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.
data(rings)
spe <- computeBanksy(rings, assay_name = "counts", M = 1, k_geom = c(15, 30))
#> Computing neighbors...
#> Spatial mode is kNN_median
#> Parameters: k_geom=15
#> Done
#> Computing neighbors...
#> Spatial mode is kNN_median
#> Parameters: k_geom=30
#> Done
#> Computing harmonic m = 0
#> Using 15 neighbors
#> Done
#> Computing harmonic m = 1
#> Using 30 neighbors
#> Centering
#> Done
banksyMatrix <- getBanksyMatrix(spe, M = 1, lambda = 0.2)