Learn R Programming

Seurat (version 5.0.3)

FindIntegrationAnchors: Find integration anchors

Description

Find a set of anchors between a list of Seurat objects. These anchors can later be used to integrate the objects using the IntegrateData function.

Usage

FindIntegrationAnchors(
  object.list = NULL,
  assay = NULL,
  reference = NULL,
  anchor.features = 2000,
  scale = TRUE,
  normalization.method = c("LogNormalize", "SCT"),
  sct.clip.range = NULL,
  reduction = c("cca", "rpca", "jpca", "rlsi"),
  l2.norm = TRUE,
  dims = 1:30,
  k.anchor = 5,
  k.filter = 200,
  k.score = 30,
  max.features = 200,
  nn.method = "annoy",
  n.trees = 50,
  eps = 0,
  verbose = TRUE
)

Value

Returns an AnchorSet object that can be used as input to IntegrateData.

Arguments

object.list

A list of Seurat objects between which to find anchors for downstream integration.

assay

A vector of assay names specifying which assay to use when constructing anchors. If NULL, the current default assay for each object is used.

reference

A vector specifying the object/s to be used as a reference during integration. If NULL (default), all pairwise anchors are found (no reference/s). If not NULL, the corresponding objects in object.list will be used as references. When using a set of specified references, anchors are first found between each query and each reference. The references are then integrated through pairwise integration. Each query is then mapped to the integrated reference.

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

scale

Whether or not to scale the features provided. Only set to FALSE if you have previously scaled the features you want to use for each object in the object.list

normalization.method

Name of normalization method used: LogNormalize or SCT

sct.clip.range

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

reduction

Dimensional reduction to perform when finding anchors. Can be one of:

  • cca: Canonical correlation analysis

  • rpca: Reciprocal PCA

  • jpca: Joint PCA

  • rlsi: Reciprocal LSI

l2.norm

Perform L2 normalization on the CCA cell embeddings after dimensional reduction

dims

Which dimensions to use from the CCA to specify the neighbor search space

k.anchor

How many neighbors (k) to use when picking anchors

k.filter

How many neighbors (k) to use when filtering anchors

k.score

How many neighbors (k) to use when scoring anchors

max.features

The maximum number of features to use when specifying the neighborhood search space in the anchor filtering

nn.method

Method for nearest neighbor finding. Options include: rann, annoy

n.trees

More trees gives higher precision when using annoy approximate nearest neighbor search

eps

Error bound on the neighbor finding algorithm (from RANN/Annoy)

verbose

Print progress bars and output

Details

The main steps of this procedure are outlined below. For a more detailed description of the methodology, please see Stuart, Butler, et al Cell 2019: tools:::Rd_expr_doi("10.1016/j.cell.2019.05.031"); tools:::Rd_expr_doi("10.1101/460147")

First, determine anchor.features if not explicitly specified using SelectIntegrationFeatures. Then for all pairwise combinations of reference and query datasets:

  • Perform dimensional reduction on the dataset pair as specified via the reduction parameter. If l2.norm is set to TRUE, perform L2 normalization of the embedding vectors.

  • Identify anchors - pairs of cells from each dataset that are contained within each other's neighborhoods (also known as mutual nearest neighbors).

  • Filter low confidence anchors to ensure anchors in the low dimension space are in broad agreement with the high dimensional measurements. This is done by looking at the neighbors of each query cell in the reference dataset using max.features to define this space. If the reference cell isn't found within the first k.filter neighbors, remove the anchor.

  • Assign each remaining anchor a score. For each anchor cell, determine the nearest k.score anchors within its own dataset and within its pair's dataset. Based on these neighborhoods, construct an overall neighbor graph and then compute the shared neighbor overlap between anchor and query cells (analogous to an SNN graph). We use the 0.01 and 0.90 quantiles on these scores to dampen outlier effects and rescale to range between 0-1.

References

Stuart T, Butler A, et al. Comprehensive Integration of Single-Cell Data. Cell. 2019;177:1888-1902 tools:::Rd_expr_doi("10.1016/j.cell.2019.05.031")

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
pancreas.list <- SplitObject(panc8, split.by = "tech")

# perform standard preprocessing on each object
for (i in 1:length(pancreas.list)) {
  pancreas.list[[i]] <- NormalizeData(pancreas.list[[i]], verbose = FALSE)
  pancreas.list[[i]] <- FindVariableFeatures(
    pancreas.list[[i]], selection.method = "vst",
    nfeatures = 2000, verbose = FALSE
  )
}

# find anchors
anchors <- FindIntegrationAnchors(object.list = pancreas.list)

# integrate data
integrated <- IntegrateData(anchorset = anchors)
}

Run the code above in your browser using DataLab