AssignCellType: Infers and assigns nearest cell type for each cell using...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/infer.R

Description

AssignCellType performs correlation-based cell type inference using a reference dataset via SingleR.

Usage

1
2
3
AssignCellType(scrna, refsets, labels = c("label.main", "label.fine"),
  outdir = NULL, method = c("single", "cluster"), clusters = NULL,
  singler.params = NULL)

Arguments

scrna

Seurat object.

refsets

List of reference dataset(s). Multiple can be provided.

labels

String indicating whether to use broad lineage-based labels labels="label.main" for each reference sample or more fine-grained labels (labels="label.fine". The former is quicker and can be informative enough if your sample has many cell types. The latter is best-suited for purified cell types or if particular cellular subtypes are important. If both are supplied, inference will be performed for both label sets.

outdir

Path to output directory for annotation scores, distributions, and heatmaps.

method

String or character vector specifying whether annotation should be applied to each single cell method = "single" or aggregated into cluster-level profiles method = "cluster" prior to annotation. If both are supplied, inference will be performed for both methods.

clusters

String or character vector defining the meta.data column(s) in scrna that specify cluster identities for each cell. Only required if method = "cluster". A character vector can be provided if multiple annotations with different clusters is wanted.

If provided with method = "single", clusters will be used as an additional label in heatmap plotting.

singler.params

List of additional arguments to be passed to SingleR.

Details

Reference datasets available for use by this function include those provided by SingleR:

If outdir is specified, the annotation results will be written to a file named in clusters.refset.labels.txt format if method="cluster" or refset.labels.txt format if method="single". Label distributions will be written to files named in refset.labels.dist.txt and refset.labels.pruned.dist.txt format. Additionally, a heatmap will be made from the annotation results via plotScoreHeatmap if there are fewer than 65500 cells (the hclust method used fails with more cells than that).

Value

A Seurat object with inferred cell type information in the meta.data slot named in refset.labels format. If method = "cluster", the resulting meta.data column will be named in clusters.refset.labels format. Pruned labels will also be added with .pruned appended to the column name.

Author(s)

Jared Andrews

See Also

SingleR for additional options.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library("Seurat")
library("SingleR")
pbmc <- pbmc_small
# Download reference data from ExperimentHub.
hpca <- HumanPrimaryCellAtlasData()
# Always give the reference set a name.
metadata(hpca)$name <- "HPCA"
pbmc.pred <- AssignCellType(pbmc, refsets = list(hpca), 
  labels = "label.main", method = "single")

pbmc.clusters.pred <- AssignCellType(pbmc, refsets = list(hpca), 
  labels = "label.fine", method = "cluster", clusters = "RNA_snn_res.1")

## Not run: 
# Use both broad and fine labels, 'Single' and 'cluster' method, multiple 
# reference sets, and multiple cluster annotations.
bp <- BlueprintEncodeData()
metadata(bp)$name <- "Blueprint_Encode"
pbmc.all.anno <- AssignCellType(pbmc, refsets = list(hpca, bp), 
  clusters = c("RNA_snn_res.0.8", "RNA_snn_res.1"))

## End(Not run)

j-andrews7/EZscRNA documentation built on Feb. 24, 2020, 10:37 a.m.