| lfcShrink {DESeq2} | R Documentation |
Adds shrunken log2 fold changes (LFC) and SE to a
results table from DESeq run without LFC shrinkage.
Three shrinkage esimators for LFC are available via type.
lfcShrink(dds, coef, contrast, res, type = c("normal", "apeglm", "ashr"),
lfcThreshold = 0, svalue = FALSE, returnList = FALSE, apeAdapt = TRUE,
apeMethod = "nbinomCR", parallel = FALSE, BPPARAM = bpparam(),
quiet = FALSE, ...)
dds |
a DESeqDataSet object, after running |
coef |
the name or number of the coefficient (LFC) to shrink,
consult |
contrast |
see argument description in |
res |
a DESeqResults object. Results table produced by the
default pipeline, i.e. |
type |
|
lfcThreshold |
a non-negative value which specifies a log2 fold change
threshold (as in |
svalue |
logical, should p-values and adjusted p-values be replaced
with s-values when using |
returnList |
logical, should |
apeAdapt |
logical, should |
apeMethod |
what |
parallel |
if FALSE, no parallelization. if TRUE, parallel
execution using |
BPPARAM |
see same argument of |
quiet |
whether to print messages |
... |
arguments passed to |
As of DESeq2 version 1.18, type="apeglm" and type="ashr"
are new features, and still under development.
Specifying apeglm passes along DESeq2 MLE log2
fold changes and standard errors to the apeglm function
in the apeglm package, and re-estimates posterior LFCs for
the coefficient specified by coef.
Specifying ashr passes along DESeq2 MLE log2
fold changes and standard errors to the ash function
in the ashr package,
with arguments mixcompdist="normal" and method="shrink".
See vignette for a comparison of shrinkage estimators on an example dataset.
For all shrinkage methods, details on the prior is included in
priorInfo(res), including the fitted_g mixture for ashr.
The integration of shrinkage methods from
external packages will likely evolve over time. We will likely incorporate an
lfcThreshold argument which can be passed to apeglm
to specify regions of the posterior at an arbitrary threshold.
For normal, and design as a formula, shrinkage cannot be applied
to coefficients in a model with interaction terms. For normal
and user-supplied model matrices, shrinkage is only supported via coef.
For normal with numeric- or list-style contrasts, it is possible to use lfcShrink,
but likely easier to use DESeq with betaPrior=TRUE followed by results,
because the numeric or list should reference the coefficients from the expanded model matrix.
These coefficients will be printed to console if 'contrast' is used with normal.
a DESeqResults object with the log2FoldChange and lfcSE
columns replaced with shrunken LFC and SE.
priorInfo(res) contains information about the shrinkage procedure,
relevant to the various methods specified by type.
type="normal":
Love, M.I., Huber, W., Anders, S. (2014) Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biology, 15:550. https://doi.org/10.1186/s13059-014-0550-8
type="apeglm":
Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for sequence count data: removing the noise and preserving large differences. bioRxiv. https://doi.org/10.1101/303255
type="ashr":
Stephens, M. (2016) False discovery rates: a new deal. Biostatistics, 18:2. https://doi.org/10.1093/biostatistics/kxw041
set.seed(1)
dds <- makeExampleDESeqDataSet(n=500,betaSD=1)
dds <- DESeq(dds)
res <- results(dds)
# these are the coefficients from the model
# we can specify them using 'coef' by name or number below
resultsNames(dds)
res.shr <- lfcShrink(dds=dds, coef=2)
res.shr <- lfcShrink(dds=dds, contrast=c("condition","B","A"))
res.ape <- lfcShrink(dds=dds, coef=2, type="apeglm")
res.ash <- lfcShrink(dds=dds, coef=2, type="ashr")