Help with limma contrast, difference of a difference?
2
0
Entering edit mode
Ahdee ▴ 50
@ahdee-8938
Last seen 17 months ago
United States

Hi I'm wondering if someone can help confirm if my contrast is correct. What want is to compare one set of analysis to another. Like a venn diagram. Circle one would be Exp A and Exp B would be another circle, so now I want to know what the different between these two experiments are.

Lets call one exp A and the exp B so now essentially I want to know the difference of the difference. Can someone help confirm my contrast below to see if I'm doing this correctly?

I think its correct, cmp = (A_exp-A_control) - ( B_exp - B_control) however why I'm concern is that when I ran pathway analysis, this analysis yield the same pathways that was present in both (A_exp-A_control) and ( B_exp - B_control) when done alone ( below contrast would be expA and expB, respectively)? How would this be possible?

thank you in advance.

input <- 'id    group
S1  A_control
S2  A_control
S3  A_control
S4  A_exp
S5  A_exp
S6  A_exp
S7  B_control
S8  B_control
S9  B_control
S10 B_exp
S11 B_exp
S12 B_exp
'

df = read.table ( text=input, header=T)

group = df$group 
design <- model.matrix(~0  +  group   )
colnames ( design) = gsub ( 'group',"",colnames(design))





contrast.matrix <- makeContrasts( 
    ,cmp = (A_exp-A_control)  - ( B_exp - B_control) 
    ,expA =  (A_exp-A_control)  # these would be simple comparison of exps in isolation. 
    , expB =  ( B_exp - B_control) 
    ,levels=design
    )
limma • 1.8k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States

That is exactly how you test the difference of differences (or the interaction term, as I was taught to call it). This should bring up genes that react differently between the A and B experiments. But that can take many forms, so you need to look closer at the data. If there aren't that many genes you can just plot each one to see what's happening.

An alternative I have used in the past is to use K-means clustering to identify genes that have the same consistent differential expression patterns. Or you could just use a heatmap of the differentially expressed genes.

ADD COMMENT
0
Entering edit mode

thanks for the confirmation. I'm still baffle why similar pathways from hypegeometric test are showing up on all three test including the interaction.

ADD REPLY
0
Entering edit mode

Might also be informative to do

vennDiagram(decideTests(fit))
ADD REPLY
0
Entering edit mode

all this time I did not thought to use this. VennDiagram was super useful but the the table even more useful to do some fast comparisons. data.frame ( decideTests(fit.r, lfc=1) ) then I can filter any combination I needed; very cool thank you I learned a couple of useful things today.

ADD REPLY
1
Entering edit mode
@steve-lianoglou-2771
Last seen 13 months ago
United States

I always find it incredibly helpful to plot logFC's of the individual tests you are looking for an interaction between on a scatterplot.

In your case, I'd plot the logFCs of all the genes of your "expA" contrast vs the logFC's of all the genes in the "expB" contrast.

If your two experiments both induce a similar response, the dots will line up along the 45 degree, if one produces a more extreme version of the other, you'll still see the points well correlated, but now you have dots lining up on the 60 degree, for instance.

A significant interaction result (in the pvalue/statistical sense) doesn't mean that you'll find points/genes in quadrants II and IV of the plot, it can also come about by both treatments having the exact same directionality in their effects, but one treatment (say expA) just has a more extreme response than the other (expB).

Maybe that's happening in your case?

ADD COMMENT
0
Entering edit mode

Or alternatively most of the genes are going in the opposite direction in the two experiments. Those genes would be significant in both individual comps, plus the interaction.

ADD REPLY
0
Entering edit mode

woohoo I like this - great idea. I'm going to try this out.

ADD REPLY
0
Entering edit mode

great, let us know how it goes!

ADD REPLY
0
Entering edit mode

thanks yes, I think this is useful and looks very nice as well. I color coded up significant up or down nc==no significant change based on fdr < .05 and logfc > abs ( 1) https://www.dropbox.com/s/vqelvhwy86jdm10/chrome_jsdMSm0BtB.png?dl=0

ADD REPLY

Login before adding your answer.

Traffic: 572 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