Entering edit mode
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")
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.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 notYes actually it is. But What's being compared I'm a little unclear on.
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.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
This is more of a question about how to model the data, rather than how to make
DiffBind
orDESeq2
work. InDiffBind
, you can make any model and test any contrast that you can withDESeq2
using thedesign
andcontrast
parameters todba.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.