confusing on the interaction and betaprior in DESeq2.
1
1
Entering edit mode
shao ▴ 100
@shao-6241
Last seen 6.8 years ago
Germany

Hi,

I still have a few questions regarding the contrast and interaction in DESeq2 after going through the forum.

1. Test on condition effect: the difference between using group variable and interactions.

There seems two ways to get the condition effect for one set basing on  the examples parts of results:

# first one:
# the condition effect in set Z
# (the interaction effect added to the main effect)
dds <- makeExampleDESeqDataSet(n=500, m = 18, betaSD = 4)
dds$set <- factor(rep(rep(c("X","Y","Z"),each=3),2))
design(dds) <- ~ set + condition + set:condition
dds <- DESeq(dds)
res <- results(dds, contrast=list(
        c("conditionB","setZ.conditionB"),
        c("conditionA","setZ.conditionA")))

# second one:
# using a grouping variable.

dds.g <- dds
dds.g$group <- factor(paste0(dds.g$set, dds.g$condition))
design(dds.g) <- ~ group
dds.g <- DESeq(dds.g)
res.g <- results(dds.g, contrast=c("group","ZB","ZA"))


cor(res[, 2], res.g[, 2])


[1] 0.9873791

The first approach seems provides larger abs(fold change) and found more DE genes.

mean(abs(res[, 2]) - abs(res.g[, 2]))

0.3428656

 

Number of DE genes in first versus second approach:
285 vs 257

My questions are:

(A) Are I correct in understanding that two approaches are basically doing the same thing?
(B) Which approach is more reasonable?

2.  Including betaPrior in the model.

It is mentioned  by Mike several times that if there are interaction terms in the model, betaPrior is recommended to be set FALSE.

dds.nb <- dds
dds.nb <- DESeq(dds.nb, betaPrior = FALSE)

If I am interested in genes show difference between A and B aing, then command is

res.nb <- results(dds.nb, contrast=list(c("condition_B_vs_A","setY.conditionB", "setZ.conditionB")))

(C) is it right?


3. Say I am interested in finding genes show interaction between conditions in set Z .

From the example of results,

res.i <- results(dds, contrast=list("setZ.conditionB","setZ.conditionA"),  independentFiltering = FALSE)

In the condition of betaPrior = FALSE,
 

resultsNames(dds.nb) gives
 "Intercept"        "set_Y_vs_X"       "set_Z_vs_X"       "condition_B_vs_A" "setY.conditionB"  "setZ.conditionB"

then "setZ.conditionB"  should be interactive terms, right?

res.nb.i <- results(dds.nb, name="setZ.conditionB", independentFiltering = FALSE)

However, the fold change is quite different compared to res.i.

So, (D) am I correct to calculate res.nb.i and (E) is the difference between fold change caused  by diabling of shrinkage?

Thanks in advance for your time and patience.

 

 

deseq2 interactions contrast • 3.2k views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 3 hours ago
United States

A,B: See my answer to a recent question:

A: DESeq2 results example

C: No, that comparison doesn't look reasonable, but I don't know what exactly you want to test. You need to be more specific.

D: yes, and E: the difference in LFC is due to shrinkage.

 

ADD COMMENT
0
Entering edit mode

Hi Mike,

Thanks a lot for your quick reply. I missed that post. In question C, I want to compare the the difference between conditions A and B ignoring set effect with "design(dds) <- ~ set + condition + set:condition" and "betaPrior = FALSE". In this case, does "condition_B_vs_A" meas the difference between B and A under Set X? Then results(dds.nb, contrast=list(c("condition_B_vs_A","setY.conditionB", "setZ.conditionB"))) give me difference between conditions A and B ignoring set effect? If not, what is the proper contrast?

I know it is easier to do it with betaPrior = TRUE, but just try to see if I get the contrast correctly in DESeq2.

ADD REPLY
0
Entering edit mode

If you have set information in the model, then it's not clear what you mean by "ignoring set effect". The real way to get the condition effect ignoring set effects would be to use a design of ~ condition.

Alternatively, you could compute the average condition effect across every set by using numeric contrasts. With the interaction design and betaPrior=FALSE, you would give a 1 to the condition_B_vs_A effect and a 1/3 to the interaction terms setY.conditionB and setZ.conditionB. The numeric vector should align with the order in resultsNames(dds), and is provided to the contrast argument.

ADD REPLY
0
Entering edit mode

Thanks Mike. I mean the main effect for condition (for all sets). In betaPrior = TRUE, it is achieved by results(dds, contrast=c("condition","B","A")). How do I get it in the betaPrior = FALSE setting?

ADD REPLY
0
Entering edit mode

Ok. you can do this using the numeric contrast strategy I posted directly above. Give a 1 to the main effect, and 1/3 to the two interaction terms, and 0 to the rest of the terms, and provide this numeric vector to the 'contrast' argument. Follow the order of resultsNames(dds).

ADD REPLY
0
Entering edit mode

Thank a lot for your help! As DESeq2  has versatile settings for the linear regression analysis, it will be really help if you could provide more examples in vignette.

ADD REPLY

Login before adding your answer.

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