spatialPreprocess: Preprocess a spatial dataset for BayesSpace

View source: R/spatialPreprocess.R

spatialPreprocessR Documentation

Preprocess a spatial dataset for BayesSpace

Description

Adds metadata required for downstream analyses, and (optionally) performs PCA on log-normalized expression of top HVGs.

Usage

spatialPreprocess(
  sce,
  platform = c("Visium", "VisiumHD", "ST"),
  n.PCs = 15,
  n.HVGs = 2000,
  skip.PCA = FALSE,
  log.normalize = TRUE,
  assay.type = "logcounts",
  BSPARAM = ExactParam(),
  BPPARAM = SerialParam()
)

Arguments

sce

SingleCellExperiment to preprocess

platform

Spatial sequencing platform. Used to determine spot layout and neighborhood structure (Visium = hex, VisiumHD = square, ST = square).

n.PCs

Number of principal components to compute. We suggest using the top 15 PCs in most cases.

n.HVGs

Number of highly variable genes to run PCA upon.

skip.PCA

Skip PCA (if dimensionality reduction was previously computed.)

log.normalize

Whether to log-normalize the input data with scater. May be omitted if log-normalization previously computed.

assay.type

Name of assay in sce containing normalized counts. Leave as "logcounts" unless you explicitly pre-computed a different normalization and added it to sce under another assay. Note that we do not recommend running BayesSpace on PCs computed from raw counts.

BSPARAM

A BiocSingularParam object specifying which algorithm should be used to perform the PCA. By default, an exact PCA is performed, as current spatial datasets are generally small (<10,000 spots). To perform a faster approximate PCA, please specify FastAutoParam() and set a random seed to ensure reproducibility.

BPPARAM

A BiocParallelParam object specifying whether to model the gene variation in parallel or not (default to SerialParam()). To perform faster modeling, please specify SnowParam() or MulticoreParam().

Value

SingleCellExperiment with PCA and BayesSpace metadata

Examples

sce <- exampleSCE()
sce <- spatialPreprocess(sce)


edward130603/BayesSpace documentation built on Oct. 23, 2024, 7:04 a.m.