#### The support.bioconductor.org editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: How to specify contrasts in DESeqDataSetFromMatrix
0
10 days ago by
florian.dufey0 wrote:

Dear forum,

I am trying to set up a data set in DESeq2 with DESeqDataSetFromMatrix to perform afterwards a likelihood ratio test in DESeq. In DESeq, I can specify a both a full and a reduced model using the standard R "model.matrix" function in which I can also set the "contrasts" (e.g. "contr.sum", or "contr.Helmert") . However, in DESeqDataSetFromMatrix it is apparently not possible to specify the contrasts.

ddsinputtimeseries <- DESeqDataSetFromMatrix(countdata, coldata,~Level + wi)


I am unsure as to why it is necessary at all to specify a model in DESeqDataSetFromMatrix and whether it will conflict with the full model I specify in DESeq.

An example would be:

ddsinput <- DESeqDataSetFromMatrix(countdata, coldata,~Level + wi)
mfull <- model.matrix(~Level+wi,coldata,contrasts=list(wi="contr.sum"))
mred  <- model.matrix(~Level)
ddstimeseries <- DESeq(ddsinput,test="LRT",full=mfull, reduced = mred,betaPrior=F)


deseq2 • 54 views
modified 10 days ago by Michael Love21k • written 10 days ago by florian.dufey0
Answer: How to specify contrasts in DESeqDataSetFromMatrix
0
10 days ago by
Michael Love21k
United States
Michael Love21k wrote:

Yes, DESeqDataSetFromMatrix is an import function, and while you specify the design, you don't specify the contrasts. This happens in results. We have extensive help in the vignette as well as a workflow. Can you take a look there?

Hello Michael, thank you very much for your fast reply! Of course I already had a close look at the vignette. I find your answer quite astonishing. The result of the LRT will depend on the contrasts chosen to build the model matrix. I don't see how this can be changed in the "results" command when the LRT has already been calculated.

Kind regards, Florian

Contrasts are for Wald tests in DESeq2.

You specify the full and reduced design for an LRT in DESeq(). You can find more help in the man pages, eg ?DESeq and the vignette.