[BioC] DESeq2 basemean and log2foldchange

Michael Love michaelisaiahlove at gmail.com
Sat Aug 2 17:50:27 CEST 2014


hi Rob,

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")

After this, you can test if the T1 effect is different in celltype 2
with the interaction:

results(dds, name="celltypeC2.treatmentT1")

The T1 effect in celltype 1 (the main effect, as celltype 1 is the
base level) is:

results(dds, contrast=c("treatment","T1","TVeh"))

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()))

Mike

On Fri, Aug 1, 2014 at 10:57 PM, rob yang <nextgame at hotmail.com> wrote:
> Thanks Steve and Mike.
>
> Ah, yes, thanks for the clarification that it is the mean of the NORMALIZED
> counts, it all makes sense now. I was comparing to the mean of raw counts. I
> guess- interpret the the "rows" being samples, but yes the word "samples"
> clarifies things definitively.
>
> After thinking a bit on the LFC question, I think I have a logical error in
> constructing the contrast, and would like to get some help.
>
> My design is 2 cell lines (C1, C2) and 4 treatments (T1,T2,T3,TVeh).
>
> ---My intention is to compare C1.T1 vs. C2.T1, and ask for the cell-specific
> effect of treatment T1---
>
> Normally this is broken down into two steps (below) but I wondered about
> 1-step comparison using interaction terms:
> 1) first find sig DEs of (C1.T1 over C1.TVeh), and conversely (C2.T1 over
> C2.TVeh).
> 2) then compare these delta DEs (over vehicle) from their respective cell
> lines, to find delta delta DEs.
>
> So for the LFC, I want to take the straight normalized counts fold change:
> log2(C1.T1/C2.T1). It is the p-value that will change depending what
> hypotheses I am testing. Now as I am typing it out loud, I realize that the
> LFC and p-value are both dependent on the contrasting terms that I put in,
> which brings to my massive confusion with interaction terms.
>
> inputFormula=formula(~celltype+treatment+celltype:treatment)
> dds_fit=DESeqDataSetFromMatrix(countData=inputData,colData=inputDesign,design=inputFormula)
> dds_fit=nbinomWaldTest(dds_fit,betaPrior=TRUE,maxit=local_maxit,useOptim=TRUE)
>
> res1=results(dds_fit,
> contrast=list("celltypeC1.treatmentT1","celltypeC2.treatmentT1"))
> res2=results(dds_fit,
> contrast=list(c("treatmentT1","celltypeC2.treatmentT1"),
>
> c("treatmentTVeh","celltypeC2.treatmentTVeh")))
> res3=results(dds_fit,
> contrast=list("celltypeC1.treatmentT1","celltypeC1.treatmentTVeh"))
>
>
> My interpretation is that:
> res1 is saying, contrasting C1-specific T1 effect over C2-specific T1 effect
> that is different from main effect of T1.
> res2 is saying, contrasting T1 effect over veh in cell type C2 that is
> different from any other cell types (C1 in this case)
> res3 is saying, contrasting C1-specific T1 effect over C1-specific TVeh
> effect that is different from those of C2-specific counter parts
>
> To me, all 3 of the above contrasts answer my intended question of C1.T1 vs
> C2.T1.
>
> Could someone help me with answering my intended question. And also
> corrections to my interpretations to the above contrast will also be very
> much appreciated.
>
> -Rob
>
> ________________________________
> Date: Fri, 1 Aug 2014 19:38:12 -0400
> Subject: Re: [BioC] DESeq2 basemean and log2foldchange
> From: michaelisaiahlove at gmail.com
> To: nextgame at hotmail.com
> CC: bioconductor at r-project.org
>
>
> Hi Rob,
> On Aug 1, 2014 2:20 PM, "rob yang" <nextgame at hotmail.com> wrote:
>>
>> Hello DESeq community,
>>
>> I wanted to ask how basemean and log2foldchange are calculated.
>>
>> 1) From mcol(mcol(dds_fit)), the basemean is denoted as "basemean over all
>> rows". But I can't pin down what "all rows" this means. For a single
>> transcript, my manual mean calculation of all counts across all replicates,
>> all conditions do not equal to the DESeq reported basemean for a single
>> transcript.
>>
>
> Yes that is kind of funny, I should change it to say "columns" or "samples".
> It is just as Steve described, the mean of normalized counts for all samples
> in the dds.
>
>> 2) log2foldchange seems to be changing with the contrasting variable. This
>> is a little surprising since I'd expect log2foldchange to be a static number
>> when comparing two conditions, and the contrasting variables only dictate
>> testing for significance, ie., p-value.
>>
>
> I don't follow. Can you say more what you mean by changing with contrasting
> variable
>
> Mike
>
>> Thank you in advance.
>>
>> -Rob
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list