View source: R/computeSpikeFactors.R
computeSpikeFactors | R Documentation |
Compute size factors based on the coverage of spike-in transcripts.
computeSpikeFactors(x, spikes, assay.type = "counts")
x |
A SingleCellExperiment object containing spike-in transcripts in an Support for spike-in transcripts in the rows of |
spikes |
String or integer scalar specifying the alternative experiment containing the spike-in transcripts. |
assay.type |
A string indicating which assay contains the counts. |
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
).
Users who want the spike-in size factors without returning a SingleCellExperiment object can simply call
librarySizeFactors(altExp(x, spikes))
, which gives the same result.
A modified x
is returned, containing spike-in-derived size factors for all cells in sizeFactors
.
Aaron Lun
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
altExps
, for the concept of alternative experiments.
librarySizeFactors
, for how size factors are derived from library sizes.
library(scuttle)
sce <- mockSCE()
sce <- computeSpikeFactors(sce, "Spikes")
summary(sizeFactors(sce))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.