I am learning about using ReportingTools for DESeqDataSet. Using the example in the user guide:
library(DESeq2)
library(ReportingTools)
data(mockRnaSeqData)
conditions <- c(rep("case",3), rep("control", 3))
mockRna.dse <- DESeqDataSetFromMatrix(countData = mockRnaSeqData,
colData = as.data.frame(conditions),
design = ~ conditions)
colData(mockRna.dse)$conditions <- factor(colData(mockRna.dse)$conditions,
levels=c("control", "case"))
# Get a DESeqDataSet object
mockRna.dse <- DESeq(mockRna.dse)
# Now the results can be written to a report using the DESeqDataSet object.
des2Report <- HTMLReport(shortName = 'RNAseq_analysis_with_DESeq2',
title = 'RNA-seq analysis of differential expression using DESeq2',
reportDirectory = "./reports")
# COMMENT 1: I added n=100 so it doesn't take so long
# COMMENT 2: .modifyDF = list(myFunc1, myFunc2) or .modifyDF = list()
# makes the Images disappear from the HTML
publish(mockRna.dse,des2Report, pvalueCutoff=0.05, n = 100,
annotation.db="org.Mm.eg.db", factor = colData(mockRna.dse)$conditions,
reportDir="./reports")
url <- finish(des2Report)
browseURL(url)
The HTML output has an Image column with stripplots of expression counts for each gene.
It is possible to write functions which modify the data frame, and publish
can call these functions if they are passed as a list via the .modifyDF
argument, e.g. .modifyDF = list(myFunc1, myFunc2)
However, when I do this, and in particular, even if I pass in an empty list (.modifyDF = list()
), the Image column in the resulting HTML is now empty. How can I pass in .modifyDF
and also preserve the generation of the stripplot images?
Thank for you this helpful information! The default argument of
.modifyDF
makes sense.However, in this particular case, it appears that
makeDESeqDF
works ondata.frames
created byDESeq
(notDESeq2
) after runningnbinomTest
.1) The DESeq example from the vignette works perfectly:
2) In contrast, trying to pass a
DESeqDataSet
object (DESeq2) topublish
works, but if I put in.modifyDF=makeDESeqDF
, it fails:because I think
makeDESeqDF
is expecting adata.frame
fromDESeq::nbinomTest
and will not work with aDESeqDataSet
object.So, what is the default argument for
.modifyDF
when aDESeqDataSet
is passed topublish
? This way I can pass a list with my custom functions and also include the default argument.Ah, you're right. For
DESeqDataSet
objects, there are a couple of functions that coerce theDESeqDataSet
to aDESeqResults
object, and then get the outputDataFrame
. So there isn't a 'stock'.modifyDF
function for this class.You probably need to ensure that you set make.plots to
TRUE
and then set up your functions to modify the resultingdata.frame
based on what you should expect to get. In other words, here is the function that will be called:So your function(s) should assume that they will be getting a
data.frame
that looks like the output from this function, and then do whatever you want based on that assumption.Thanks! I'll look into that.