computeSpikeFactors {scran}R Documentation

Normalization with spike-in counts

Description

Compute size factors based on the coverage of spike-in transcripts.

Usage

computeSpikeFactors(x, spikes, type = NULL, assay.type = "counts",
  sf.out = FALSE, general.use = TRUE)

Arguments

x

A SingleCellExperiment object containing spike-in transcripts in an altExps entry.

Support for spike-in transcripts in the rows of x itself is deprecated.

spikes

String or integer scalar specifying the alternative experiment containing the spike-in transcripts.

type

Deprecated, a character vector specifying which spike-in sets to use.

assay.type

A string indicating which assay contains the counts.

sf.out

Deprecated, a logical scalar indicating whether only size factors should be returned.

general.use

A logical scalar indicating whether the size factors should be stored for general use by all genes.

Details

The spike-in size factor for each cell is computed from the sum of all spike-in counts in each cell. This aims to scale the counts to equalize spike-in coverage between cells, thus removing differences in coverage due to technical effects like capture or amplification efficiency.

Spike-in normalization can be helpful for preserving changes in total RNA content between cells, if this is of interest. Such changes would otherwise be lost when normalizing with methods that assume a non-DE majority. Indeed, spike-in normalization is the only available approach if a majority of genes are DE between two cell types or states.

Size factors are computed by applying librarySizeFactors to the spike-in count matrix. This ensures that the mean of all size factors is unity for standardization purposes, if one were to compare expression values normalized with sets of size factors (e.g., in modelGeneVarWithSpikes).

Value

A modified x is returned, containing spike-in-derived size factors for all cells in sizeFactors.

Author(s)

Aaron Lun

References

Lun ATL, McCarthy DJ and Marioni JC (2016). A step-by-step workflow for low-level analysis of single-cell RNA-seq data with Bioconductor. F1000Res. 5:2122

See Also

altExps, for the concept of alternative experiments.

librarySizeFactors, for how size factors are derived from library sizes.

Examples

library(scater)
sce <- mockSCE()
sce <- computeSpikeFactors(sce, "Spikes")
summary(sizeFactors(sce))

# Deprecated behavior:
y <- sce
altExps(y) <- NULL
y <- rbind(y, altExp(sce))
suppressWarnings(isSpike(y, "ERCC") <- nrow(sce) + seq_len(nrow(altExp(sce))))
suppressWarnings(y <- computeSpikeFactors(y))

y2 <- y

[Package scran version 1.14.6 Index]