FindTransferAnchors: Find transfer anchors

Description Usage Arguments Details Value References Examples

View source: R/integration.R

Description

Find a set of anchors between a reference and query object. These anchors can later be used to transfer data from the reference to query object using the TransferData object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
FindTransferAnchors(
  reference,
  query,
  normalization.method = "LogNormalize",
  recompute.residuals = TRUE,
  reference.assay = NULL,
  reference.neighbors = NULL,
  query.assay = NULL,
  reduction = "pcaproject",
  reference.reduction = NULL,
  project.query = FALSE,
  features = NULL,
  npcs = 30,
  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,
  approx.pca = TRUE,
  mapping.score.k = NULL,
  verbose = TRUE
)

Arguments

reference

Seurat object to use as the reference

query

Seurat object to use as the query

normalization.method

Name of normalization method used: LogNormalize or SCT.

recompute.residuals

If using SCT as a normalization method, compute query Pearson residuals using the reference SCT model parameters.

reference.assay

Name of the Assay to use from reference

reference.neighbors

Name of the Neighbor to use from the reference. Optionally enables reuse of precomputed neighbors.

query.assay

Name of the Assay to use from query

reduction

Dimensional reduction to perform when finding anchors. Options are:

  • pcaproject: Project the PCA from the reference onto the query. We recommend using PCA when reference and query datasets are from scRNA-seq

  • cca: Run a CCA on the reference and query

reference.reduction

Name of dimensional reduction to use from the reference if running the pcaproject workflow. Optionally enables reuse of precomputed reference dimensional reduction.

project.query

Project the PCA from the query dataset onto the reference. Use only in rare cases where the query dataset has a much larger cell number, but the reference dataset has a unique assay for transfer. In this case, the default features will be set to the variable features of the query object that are alos present in the reference.

features

Features to use for dimensional reduction. If not specified, set as variable features of the reference object which are also present in the query.

npcs

Number of PCs to compute on reference if reference.reduction is not provided.

l2.norm

Perform L2 normalization on the cell embeddings after dimensional reduction

dims

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

k.anchor

How many neighbors (k) to use when finding anchors

k.filter

How many neighbors (k) to use when filtering anchors. Set to NA to turn off filtering.

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)

approx.pca

Use truncated singular value decomposition to approximate PCA

mapping.score.k

Compute and store nearest k query neighbors in the AnchorSet object that is returned. You can optionally set this if you plan on computing the mapping score and want to enable reuse of some downstream neighbor calculations to make the mapping score function more efficient.

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. doi: 10.1016/j.cell.2019.05.031; doi: 10.1101/460147

Value

Returns an AnchorSet object that can be used as input to TransferData

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
# to install the SeuratData package see https://github.com/satijalab/seurat-data
library(SeuratData)
data("pbmc3k")

# for demonstration, split the object into reference and query
pbmc.reference <- pbmc3k[, 1:1350]
pbmc.query <- pbmc3k[, 1351:2700]

# perform standard preprocessing on each object
pbmc.reference <- NormalizeData(pbmc.reference)
pbmc.reference <- FindVariableFeatures(pbmc.reference)
pbmc.reference <- ScaleData(pbmc.reference)

pbmc.query <- NormalizeData(pbmc.query)
pbmc.query <- FindVariableFeatures(pbmc.query)
pbmc.query <- ScaleData(pbmc.query)

# find anchors
anchors <- FindTransferAnchors(reference = pbmc.reference, query = pbmc.query)

# transfer labels
predictions <- TransferData(
  anchorset = anchors,
  refdata = pbmc.reference$seurat_annotations
)
pbmc.query <- AddMetaData(object = pbmc.query, metadata = predictions)

## End(Not run)

ibseq/scs-analysis documentation built on Feb. 27, 2021, 12:35 a.m.