Learn R Programming

scran (version 1.0.3)

Spike-in normalization: Normalization with spike-in counts

Description

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

Usage

"computeSpikeFactors"(x)

Arguments

x
A SCESet object containing rows corresponding spike-in transcripts.

Value

An object of class x is returned, containing a numeric vector of size factors for all cells in sizeFactors(x).

Details

The size factor for each cell is defined as the sum of all spike-in counts in each cell. This is equivalent to normalizing to equalize spike-in coverage between cells. Spike-in counts are assumed to be stored in rows with fData(x)$is_control_feature -- see ?isSpike<- for more details. Note that the geometric mean of all size factors is set to unity, for standardization purposes if one were to compare different sets of size factors.

See Also

SCESet

Examples

Run this code
set.seed(100)
popsize <- 200
ngenes <- 1000
all.facs <- 2^rnorm(popsize, sd=0.5)
counts <- matrix(rnbinom(ngenes*popsize, mu=all.facs*10, size=1), ncol=popsize, byrow=TRUE)
spikes <- matrix(rnbinom(100*popsize, mu=all.facs*10, size=0.5), ncol=popsize, byrow=TRUE)

combined <- rbind(counts, spikes)
colnames(combined) <- seq_len(popsize)
rownames(combined) <- seq_len(nrow(combined))
y <- newSCESet(countData=combined)
isSpike(y) <- rep(c(FALSE, TRUE), c(ngenes, 100))
out.facs <- computeSpikeFactors(y)

Run the code above in your browser using DataLab