DiffBind: dba.contrast for interaction terms
0
0
Entering edit mode
@lindsaynhayes-13285
Last seen 13 months ago
United States

Love the new design feature of DiffBind! However, I am having trouble writing the contrast for the interaction terms. I've used this tutorial for writing contrasts in DESeq2 for RNA seq results and thought the approach would work in DiffBind.

DBA <- dba.contrast(DBA, design = '~ Condition * Treatment')
DBA$DESeq2
$names
[1] "Intercept"                 "Condition_MUT_vs_CON"     
[3] "Treatment_A_vs_SAL"      "Treatment_B_vs_SAL"      
[5] "ConditionMUT.TreatmentA" "ConditionMUT.TreatmentB"

# Trt A effect in CON
DBA <- dba.contrast(DBA, contrast = list("Treatment_A_vs_SAL"))

# Trt A effect in MUT
DBA <- dba.contrast(DBA, contrast = list(c("Treatment_A_vs_SAL", "ConditionMUT.TreatmentA")) 

Warning message:
In if (!contrast[[1]] %in% names) { :
  the condition has length > 1 and only the first element will be used

# so I added the coefficients based on the description from this paper (https://f1000research.com/articles/9-512)
DBA <- dba.contrast(DBA, contrast = list(("Treatment_A_vs_SAL"+"ConditionMUT.TreatmentA")))
Error in "Treatment_A_vs_SAL" + "ConditionMUT.TreatmentA" : 
  non-numeric argument to binary operator


# MUT vs CON at Treatment SAL
DBA <- dba.contrast(DBA, contrast = list("Condition_MUT_vs_CON"))
Warning messages:
1: In if (!contrast[[1]] %in% names) { :
  the condition has length > 1 and only the first element will be used
2: In if (!contrast[[1]] %in% names) { :
  the condition has length > 1 and only the first element will be used

# MUT vs CON at Treatment A
DBA <- dba.contrast(DBA, contrast = list(c("Condition_MUT_vs_CON", "ConditionMUT.TreatmentA")))
Warning messages:
1: In if (!contrast[[1]] %in% names) { :
  the condition has length > 1 and only the first element will be used
2: In if (!contrast[[1]] %in% names) { :
  the condition has length > 1 and only the first element will be used

What is the syntax for incorporating interactions into the contrasts? In the previous version I used a non design approach, but I was hoping utilizing the linear modeling would be more sensitive.

DBA <- dba.contrast(DBA, group1= DBA$masks$CON:A, group2= DBA$masks$CON:SAL, name1="CON:A", name2="CON:SAL")
DiffBind • 2.4k views
ADD COMMENT
0
Entering edit mode

I think I figured something out. The documentation mentioned that you could use bRetrieveAnalysis to convert the DBA DiffBind object into a DESeq object. Once it is in a DESeqDataSet object then the contrasts above work with the DESeq2 syntax.

    dds <- dba.analyze(DBA, bRetrieveAnalysis=DBA_DESEQ2)
    summary(results(dds, list( c("Treatment_A_vs_SAL","ConditionMUT.TreatmentA")), alpha=0.05))
ADD REPLY
0
Entering edit mode

Does the summary of the DESeq2 object and dba.show(DBA) yield the same number of significant genes for you? In my case it did not

ADD REPLY
0
Entering edit mode

Yes actually it is. But What's being compared I'm a little unclear on.

dba.show(DBA, bContrasts=TRUE)
Design: [~ Condition * Treatment] | 4 Contrasts:
     Factor Group Samples Group2 Samples2 DB.DESeq2
1 Condition   CON      17    MUT       17         0
2 Treatment   SAL      11    A       12      4755
3 Treatment   SAL      11    B       11      4916
4 Treatment    B       11    A       12      9367

For example, in contrast #2, it looks like it is ignoring condition and just looking at SAL vs A based on the sample sizes when in reality it is a mixture of CON:SAL, MUT:SAL, vs CON:A, MUT:A.

From my understanding based on the tutorial link at the very top, writing out the contrast of "Treatment_A_vs_SAL" will just give the effect of treatment in the reference group (CON here) not all the samples together.

DBA <- dba.analyze(DBA, bRetrieveAnalysis=DBA_DESEQ2) # DESeqDataSet

# The effect of A in CON
summary(results(DBA, name="Treatment_A_vs_SAL", alpha=0.05))
LFC > 0 (up)       : 2402, 3.5%
LFC < 0 (down)     : 2353, 3.4%


# The effect of B in CON
summary(results(DBA, name="Treatment_B_vs_SAL", alpha=0.05))
LFC > 0 (up)       : 2636, 3.8%
LFC < 0 (down)     : 2280, 3.3%

In any case 2402 + 2353 = 4755 (contrast 2) & 2636 + 2280 = 4916 (contrast 3)

My lingering question now is if this represents the effect of treatment agnostic to condition or whether it is the effect of treatment in the reference condition as I expected?

Thoughts? Michael Love Rory Stark

ADD REPLY
1
Entering edit mode

This is more of a question about how to model the data, rather than how to make DiffBind or DESeq2 work. In DiffBind, you can make any model and test any contrast that you can with DESeq2 using the design and contrast parameters to dba.contrast().

I try to avoid consulting here on exactly what design and contrast to use for more complex modelling -- it is best to talk to a specialist statistician if you are able.

ADD REPLY

Login before adding your answer.

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