[BioC] [ReportingTools] and DESeq2 results, publish DESeqDataSet using resultsNames other than the default

James W. MacDonald jmacdon at uw.edu
Wed Jan 22 16:02:38 CET 2014


Hi Dimitra,


On 1/22/2014 6:29 AM, Dimitra Alexopoulou wrote:
> Dear all,
>
> I've been happily using ReportingTools to publish an html report of my 
> DESeq2 results so far having only two conditions to compare (i.e. WT 
> to KO).
> I now have one Ctrl condition and three different mutations (say Mut1, 
> Mut2 and Mut3):
>
> levels(condition) # my 4 different conditions
> # [1] "Ctrl" "Mut1" "Mut2" "Mut3"
>
> dds # my DESeqDataset, including the results
> # class: DESeqDataSet
> # dim: 24791 12
> # exptData(0):
> # assays(3): counts mu cooks
> # rownames(24791): ENSMUSG00000000001 ENSMUSG00000000028 ... 
> ENSMUSG00000093778 ENSMUSG00000093789
> # rowData metadata column names(31): baseMean baseVar ... deviance 
> maxCooks
> # colnames(12): Ctrl_1 Ctrl_2 ... Mut3_2 Mut3_3
> # colData names(2): condition sizeFactor
>
> resultsNames(dds) # the results I have from DESeq2 saved in the dds
> # [1] "Intercept" "condition_Mut1_vs_Ctrl" "condition_Mut2_vs_Ctrl" 
> "condition_Mut3_vs_Ctrl"
>
>
> When I want to create the html report of the DESeq2 results obtained, 
> I do the following:
>
> # Creating the html report using ReportingTools:
> desReport <- HTMLReport(shortName = "Blah_over_Ctrl_DEGs",
> title = 'Blah detailed results',
> basePath = myOutdir,
> reportDirectory = "./DEreports"
> )
> publish(dds, desReport, pvalueCutoff=0.1, factor = 
> colData(dds)$condition)

 From ?publish:

DESeqDataSet:
‘publish(object, publicationType, factor = NULL, n = 1000,
pvalueCutoff = 0.01, lfc = 0, coef = NULL, make.plots = TRUE,
..., name)’ To coerce a ‘DESeqDataSet’ to a ‘data.frame’, we
use the ‘results’ function from the ‘DESeq2’ package,
therefore one of ‘DESeq’, or something similar must be run
prior to ‘publish’. By default, the last coefficient from
‘resultsNames’ is reported. Log fold changes, p-values and
adjusted p-values are taken directly from the DESeqDataSet.
Stripplots showing the expression values for each transcript
are produced based on the normalized counts from the
‘DESeqDataSet’, grouped by the levels in ‘factor’.

So you want to do the paradigmatic

html <- HTMLReport(args go here)
publish(object, html, coef=2)
finish(html)

html <- HTMLReport(args go here)
publish(object, html, coef=3)
finish(html)

and like that until you have done all coefficients. Alternatively, you 
can construct a vector of the short names for the html pages, and the 
more descriptive names and run through using lapply():

sn <- resultNames(dds)[-1]
ln <- paste("Mutation", 1:3, "versus Control")

out <- lapply(1:3, function(x) {
tmp <- HTMLReport(sn[x], ln[x], basePath = myOutdir,
reportDirectory = "./DEreports")
publish(dds, tmp, coef = x+1, pvalueCutoff=0.1, factor = 
colData(dds)$condition)
return(finish(tmp))})

Then you can make an index page to tie it all together

indx <- HTMLReport("index", "Look at these sweet results!")
publish(Link(out, report = indx), indx)
finish(index)

Best,

Jim



> finish(desReport)
>
> The above returns by default results for the last coefficient from 
> resultsNames, in my case: "condition_Mut3_vs_Ctrl".
>
> Is there a way to by-pass this default behaviour and output either:
> a. all results in one report, or
> b. each one of the results in a separate report, specifying this 
> somehow to publish(), e.g.:
> publish(dds,name="condition_Mut2_vs_Ctrl", desReport, 
> pvalueCutoff=0.1, factor=colData(dds)$condition)
> Or do I need to create a new dds_Mut2_over_Ctrl, subsetting the 
> initial dds (which I don't know how to do and this would be my next 
> question, especially to the DESeq2 people).
> I would like to avoid breaking the analysis into 3 comparisons from 
> the beginning (meaning constructing 3 different DESeqDataSets and 
> running the differential expression analysis on them).
>
> Thanks in advance,
> Dimitra
>

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list