You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, first we create a list of lists (``lst``), and then we used ``map()`` to apply
214
214
the ``make_dds`` function to all items in the list. The collapsing of
@@ -260,6 +260,24 @@ adds some extra convenience when working with lists of dds objects, including
260
260
the detection of parallelization as set up in the config object. See the help
261
261
for ``lcdbwf::make_results()`` for more details.
262
262
263
+
By default, if no test argument is specified in the parameters for
264
+
``lcdbwf::make_dds`` found here in `examples 1-4, <https://github.com/lcdb/lcdb-wf/blob/LRT/workflows/rnaseq/downstream/rnaseq.Rmd#L164-L187>`_
265
+
the Wald test is performed. When ``lcdbwf::make_results`` processes a Wald test dds object, it
266
+
detects the Wald test and expects a ``contrast`` or ``coef`` argument to specify which
267
+
p-values and log2FoldChange values to report.
268
+
269
+
DESeq2 also supports the nBinomLRT (LRT). `Example 5 <https://github.com/lcdb/lcdb-wf/blob/LRT/workflows/rnaseq/downstream/rnaseq.Rmd#L189-L194>`_
270
+
demonstrates how to create a dds object with LRT data. Since the LRT tests
271
+
the removal of one or more terms from the design formula, a single
272
+
log2FoldChange column doesn't reflect the test's complexity. DESeq2's results
273
+
object is optimized for the Wald test, and when storing LRT results, it
274
+
maintains consistency in datastructure by choosing a single pair-wise comparison for
275
+
log2FoldChange values. To avoid confusion, ***we set all log2FoldChange values to
276
+
0 for LRT results***.
277
+
278
+
For more details, see the DESeq2 documentation:
279
+
`DESeq2 Likelihood Ratio Test <https://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#i-ran-a-likelihood-ratio-test-but-results-only-gives-me-one-comparison>`_.
280
+
263
281
.. _rules:
264
282
265
283
To take advantage of this infrastructure, we put each of those contrasts into
# When make_results is called with 'test' set to 'LRT',
199
+
# or when make_results is called with 'test' missing but the
200
+
# DDS object contains the LRT, we convert all values in the log2FoldChange
201
+
# column of the DESeqResults object to 0. LFC values only make sense to report for a single
202
+
# comparison of two sample groups. This only applies to the Wald test.
203
+
# LRT is instead performing a test of the removal of one or more factor(s) from the design formula.
204
+
# DESeq2 reports log2FoldChange values for a single pair-wise comparison when test == 'LRT'. This
205
+
# can be misleading and so this is our solution.
206
+
207
+
# Adjust log2FoldChange for LRT test
208
+
if (!is.null(dots$test) &&dots$test=='LRT') {
209
+
res$log2FoldChange<-0
210
+
warning("All log2FoldChange values in the DESeq2 results object have been set to 0. See https://github.com/lcdb/lcdb-wf/blob/master/docs/rnaseq-rmd.rst?plain=1#L269.")
195
211
}
196
212
197
-
# Add to results object so we can report it out later.
198
-
metadata(res)$type<-shrinkage_type
213
+
# Checks for LRT test and non-NULL type
214
+
if (!is.null(dots$type) &&!is.null(dots$test) &&dots$test=='LRT'&&!test_detected) {
215
+
stop("You cannot pass a non-NULL or missing type to make_results with test == 'LRT'. For LRT, LFC values are set to 0 and should not be passed to lfcShrink. Use type == NULL in make_results for LRT DDS objects.")
stop("You cannot pass a non-NULL or missing type to make_results with an LRT dds object. For LRT, LFC values are set to 0 and should not be passed to lfcShrink. Use type == NULL in make_results for LRT DDS objects.")
0 commit comments