runBanksyPCA: Run PCA on a BANKSY matrix.

View source: R/reduction.R

runBanksyPCAR Documentation

Run PCA on a BANKSY matrix.

Description

Run PCA on a BANKSY matrix.

Usage

runBanksyPCA(
  se,
  use_agf = FALSE,
  lambda = 0.2,
  npcs = 20L,
  assay_name = NULL,
  scale = TRUE,
  group = NULL,
  M = NULL,
  seed = NULL
)

Arguments

se

A SpatialExperiment, SingleCellExperiment or SummarizedExperiment object with computeBanksy ran.

use_agf

A logical vector specifying whether to use the AGF for computing principal components.

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.

npcs

An integer scalar specifying the number of principal components to compute.

assay_name

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

scale

A logical scalar specifying whether to scale features before PCA. Defaults to TRUE.

group

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

M

Advanced usage. An integer vector specifying the highest azimuthal Fourier harmonic to use. If specified, overwrites the use_agf argument.

seed

Seed for PCA. If not specified, no seed is set.

Details

This function runs PCA on the BANKSY matrix (see getBanksyMatrix) with features scaled to zero mean and unit standard deviation.

Value

A SpatialExperiment / SingleCellExperiment / SummarizedExperiment object with PC coordinates in reducedDims(se).

Examples

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


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