[BioC] DESeq2 basemean and log2foldchange

Michael Love michaelisaiahlove at gmail.com
Mon Aug 4 03:51:06 CEST 2014

On Sun, Aug 3, 2014 at 12:19 AM, rob yang <nextgame at hotmail.com> wrote:
> Thanks very much Mike. This has been very very helpful. Let me strike the
> iron while it's hot once for all, please bear with me one more time.
>> As you have a clear base level of treatment (vehicle), I'd recommend
>> using a standard model matrix with base levels of C1 and TVeh. I will
>> make a note to include more documentation on this option.
>> dds$celltype <- relevel(dds$celltype, "C1")
>> dds$treatment <- relevel(dds$treatment, "TVeh")
>> dds <- DESeq(dds, modelMatrixType="standard")
> This was very clear in the current documentation (v1.4.5). This was indeed
> what I did, but didn't include in the original post to cut down the length.
>> After this, you can test if the T1 effect is different in celltype 2
>> with the interaction:
>> results(dds, name="celltypeC2.treatmentT1")
> Got it. My mistake was to ignore the implicitly defined base levels, and was
> doing:
> results(dds,contrast=list("celltypeC2.treatmentT1","celltypeC1.treatmentT1"))
> Out of curiosity, what does my contrast statement above do, if sensible at
> all?

You won't have an interaction term "celltypeC1.treatmentT1" if you use
the code I suggested above, i.e.

dds <- DESeq(dds, modelMatrixType="standard")

because C1 is the base level.

>> The T1 effect in celltype 1 (the main effect, as celltype 1 is the
>> base level) is:
>> results(dds, contrast=c("treatment","T1","TVeh"))
> Clear.
>> The T1 effect in celltype 2 is the main effect above plus the interaction:
>> results(dds,
>> contrast=list(c("treatment_T1_vs_TVeh","celltypeC2.treatmentT1"),character()))
> syntax-wise, will this be?
> results(dds,contrast=list(c("treatmentT1","celltypeC2.treatmentT1"),character()))
> additional questions:
> 1) to compare baseline (Veh) DEs b/w two cell lines:
> results(dds,name="celltypeC2") or
> results(dds,contrast=list(c("celltypeC2","celltypeC2.treatmentVeh"),
> c("celltypeC1","celltypeC1.treatmentVeh"))

this is just

results(dds, contrast=c("celltype","C2","C1"))

or equivalently

results(dds, name="celltype_C2_vs_C1")

> 2) if I have 3 treatments in total, T1, T2, T3, plus TVeh, and I want to
> compare T1 vs. T2 in C2, would i do:
> results(dds,contrast=list("celltypeC2.treatmentT1","celltypeC.treatmentT2"))

This is the main effect for T1 plus the interaction term for C2 and T1
over the main effect for T2 plus the interaction term for C2 and T2.

results(dds, contrast=list(c("treatment_T1_vs_TVeh","celltypeC2.treatmentT1"),


> -Rob

More information about the Bioconductor mailing list