How to compute "second-order" differences
1
0
Entering edit mode
kjo ▴ 70
@kjo-11078
Last seen 7.9 years ago

This is another hypothetical/toy example. I have 3 samples, corresponding to one untreated condition and two treated ones, as encoded in the metadata table below:

    > metadata
       drug
    1  NONE
    2     A
    3     B


Now, I create two deseq datasets, with different designs:

    dds <- DESeq(DESeqDataSetFromMatrix(countData = counts,
                                           colData = metadata,
                                           design = ~ drug))

Finally, I compute results like this:

    results <- list(A = results(dds, contrast = c("drugA", "drugNONE")),
                    B = results(dds, contrast = c("drugB", "drugNONE")))

I'd call the results above "first-order", because they are all differences between the treated conditions and the untreated one.

I am interested, however, in the "second-order" results, namely the "differences between the differences". IOW, how do the effects of drugs A and B (relative to the untreated case) differ.

deseq2 • 890 views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 5 days ago
United States

results(dds, contrast=c("drug","A","none")) gives you A - NONE (on the log scale, i.e. log fold changes)

results(dds, contrast=c("drug","B","none")) gives you B - NONE 

results(dds, contrast=c("drug","B","A")) gives you B - A

You don't need to construct (B - NONE) - (A - NONE) because this is simply (B - A) after some simple algebra.

ADD COMMENT
0
Entering edit mode

But is this the correct answer for this question?

results(dds, contrast=c("drug","B","A")) gives you B - A

Does this comparison gives me the wanted "second-order" differences? If i'm not mistaken, I get here the direct comparison of B vs. A. What kjo though really need is something like [B vs. NONE] vs. [A vs. NONE]. Is it the same as [B vs. A]?

 

ADD REPLY
0
Entering edit mode
No, it's the same. Try rearranging the terms. What's (3/x) / (5/x) ?
ADD REPLY

Login before adding your answer.

Traffic: 509 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6