multiBlockVar {scran} | R Documentation |
Fit a mean-dependent trend to the per-gene variances for each blocking level, and decompose them to biological and technical components.
This has now been deprecated in favor of the block
argument in modelGeneVar
and related functions.
multiBlockVar(x, block, make.tech.trend=FALSE, trend.args=list(), dec.args=list(), assay.type="logcounts", ...)
x |
A SingleCellExperiment object containing log-normalized expression values, computed with |
block |
A factor specifying the blocking level for each cell in |
make.tech.trend |
A logical scalar indicating whether to use |
trend.args |
A list of named arguments to pass to |
dec.args |
A list of named arguments to pass to |
assay.type |
A string or integer scalar specifying the assay in |
... |
Additional arguments to pass to |
This function models the variance of expression in each level of block
separately.
Each subset of cells is passed to trendVar
(or makeTechTrend
) to fit a block-specific trend,
and then passed to decomposeVar
to obtain block-specific biological and technical components.
Results are consolidated across blocks using the combineVar
function.
The aim is to enable users to handle differences in the mean-variance relationship across, e.g., different experimental batches.
We assume that the size factors for the endogenous genes have the same mean as the size factors for the spike-ins within each block.
This ensures that the spike-in normalized values are comparable to those of the endogenous genes.
Centering should be performed by running multiBlockNorm
before calling this function.
Otherwise, a warning will be raised about non-centered size factors.
A DataFrame is returned containing all components returned by combineVar
, in addition to a per.block
column.
This additional column is a DataFrame containing nested DataFrames, each containing a result of decomposeVar
for the corresponding level of block
.
The trend function from trendVar
or makeTechTrend
is also stored as trend
in the metadata of the per-block nested DataFrames.
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
trendVar
,
decomposeVar
,
combineVar
,
multiBlockNorm
example(computeSpikeFactors) # Using the mocked-up data 'y' from this example. # Normalizing (gene-based factors for genes, spike-in factors for spike-ins) y <- computeSumFactors(y) y <- computeSpikeFactors(y, general.use=FALSE) # Setting up the blocking levels. block <- sample(3, ncol(y), replace=TRUE) y <- multiBlockNorm(y, block) out <- multiBlockVar(y, block=block) # Creating block-level plots. par(mfrow=c(1,3)) is.spike <- isSpike(y) for (x in as.character(1:3)) { current <- out$per.block[[x]] plot(current$mean, current$total, col="black", pch=16) points(current$mean[is.spike], current$total[is.spike], col="red", pch=16) curve(metadata(current)$trend(x), col="dodgerblue", lwd=2, add=TRUE) }