Learn R Programming

Seurat (version 5.0.3)

PrepSCTIntegration: Prepare an object list normalized with sctransform for integration.

Description

This function takes in a list of objects that have been normalized with the SCTransform method and performs the following steps:

  • If anchor.features is a numeric value, calls SelectIntegrationFeatures to determine the features to use in the downstream integration procedure.

  • Ensures that the sctransform residuals for the features specified to anchor.features are present in each object in the list. This is necessary because the default behavior of SCTransform is to only store the residuals for the features determined to be variable. Residuals are recomputed for missing features using the stored model parameters via the GetResidual function.

  • Subsets the scale.data slot to only contain the residuals for anchor.features for efficiency in downstream processing.

Usage

PrepSCTIntegration(
  object.list,
  assay = NULL,
  anchor.features = 2000,
  sct.clip.range = NULL,
  verbose = TRUE
)

Value

A list of Seurat objects with the appropriate scale.data slots containing only the required anchor.features.

Arguments

object.list

A list of Seurat objects to prepare for integration

assay

The name of the Assay to use for integration. This can be a single name if all the assays to be integrated have the same name, or a character vector containing the name of each Assay in each object to be integrated. The specified assays must have been normalized using SCTransform. If NULL (default), the current default assay for each object is used.

anchor.features

Can be either:

  • A numeric value. This will call SelectIntegrationFeatures to select the provided number of features to be used in anchor finding

  • A vector of features to be used as input to the anchor finding process

sct.clip.range

Numeric of length two specifying the min and max values the Pearson residual will be clipped to

verbose

Display output/messages

Examples

Run this code
if (FALSE) {
# to install the SeuratData package see https://github.com/satijalab/seurat-data
library(SeuratData)
data("panc8")

# panc8 is a merged Seurat object containing 8 separate pancreas datasets
# split the object by dataset and take the first 2 to integrate
pancreas.list <- SplitObject(panc8, split.by = "tech")[1:2]

# perform SCTransform normalization
pancreas.list <- lapply(X = pancreas.list, FUN = SCTransform)

# select integration features and prep step
features <- SelectIntegrationFeatures(pancreas.list)
pancreas.list <- PrepSCTIntegration(
  pancreas.list,
  anchor.features = features
)

# downstream integration steps
anchors <- FindIntegrationAnchors(
  pancreas.list,
  normalization.method = "SCT",
  anchor.features = features
)
pancreas.integrated <- IntegrateData(anchors, normalization.method = "SCT")
}

Run the code above in your browser using DataLab