DESeq2 with multi level
1
0
Entering edit mode
pierre.k • 0
@pierrek-15653
Last seen 6.0 years ago

Hello,

I run DESeq2 with multilevel. For each of the levels, I run "results" with the desired contrast between pairs of conditions. When I run resultsNames, I noticed that  output refers to the first level as background. Also, lfcShrink  shows different condition for "log2 fold change (MAP)" and "Wald test p-value". Here is a snapshot of what is happening but I am willing to share more offline.

> dds$condition <- factor(dds$condition, levels = c("K_DMSO", "K_I50", "K_I500", "K_I5000", "M_DMSO", "M_I50", "M_I500", "M_I5000"))
> dds <- DESeq(dds)
> resM_5000vsM_DMSO <- results(dds, contrast = c("condition","M_I5000", "M_DMSO"))
> resultsNames(dds)
[1] "Intercept"    "condition_K_I50_vs_K_DMSO"   "condition_K_I500_vs_K_DMSO"  "condition_K_I5000_vs_K_DMSO" "condition_M_DMSO_vs_K_DMSO"  "condition_M_I50_vs_K_DMSO" "condition_M_I500_vs_K_DMSO"  "condition_M_I5000_vs_K_DMSO"
> resM_5000vsM_DMSOLFC <- lfcShrink(dds = dds, coef = 2, res = resM_5000vsM_DMSO)
> resM_5000vsM_DMSOLFC_contrast <- lfcShrink(dds = dds, contrast = c("condition","M_I5000", "M_DMSO"), res = resM_5000vsM_DMSO)

for resM_5000vsM_DMSO, I have "log2 fold change (MLE): condition M_I5000 vs M_DMSO"

for resM_5000vsM_DMSOLFC, I have "log2 fold change (MAP): condition K I50 vs K DMSO"  ?(Although run on resM_5000vsM_DMSO)

for resM_5000vsM_DMSOLFC_contrast, I have "log2 fold change (MAP): condition M_I5000 vs M_DMSO"

I have two questions:

1) why is resultsNames returning conditions where always one reference is considered (K_DMSO)?

2) why lfcShrink behaves differently with coef than with contrast, and which one should be used assuming I need to get the shrunken LFC for each condition

Many thanks and any help is appreciated.

deseq2 lfcshrink • 1.9k views
ADD COMMENT
0
Entering edit mode

Oops, I missed this post because it didn't have the tag 'deseq2'. I'm fixing that now and will answer.

ADD REPLY
2
Entering edit mode
@mikelove
Last seen 12 minutes ago
United States

The first time you call lfcShrink, you are giving the software conflicting information. You are saying to shrink coef=2, which refers to "condition_K_I50_vs_K_DMSO" (the second element of resultsNames(dds)), but you are supplying the results table "resM_5000vsM_DMSO", which describes a different comparison.

I'd recommend to not supply the results table, as lfcShrink() will now build the correct one for you internally. You can use 'coef' or 'contrast', but if you want to compare against arbitrary denominators, you should use 'contrast'.

ADD COMMENT
0
Entering edit mode

I agree and it makes sense, thanks. However, why is "resultsNames(dds))" returning conditions that I didn't test for (i.e condition_M_I50_vs_K_DMSO). In all my contrasts, I contrast to DMSO of the same cell line (M_IXXX against M_DMSO, K_IXXX against K_DMSO). 

For instance, here are the results that I am building and none of them correspond to "condition_M_I50_vs_K_DMSO"

resM_5000vsM_DMSO <- results(dds, contrast = c("condition","M_I5000", "M_DMSO"))
resM_500vsM_DMSO <- results(dds, contrast = c("condition", "M_I500", "M_DMSO"))
resM_50vsM_DMSO <- results(dds, contrast = c("condition", "M_I50", "M_DMSO"))
resK_5000vsK_DMSO <- results(dds, contrast = c("condition", "K_I5000", "K_DMSO"))
resK_500vsK_DMSO <- results(dds, contrast = c("condition", "K_I500", "K_DMSO"))
resK_50vsK_DMSO <- results(dds, contrast = c("condition", "K_I50", "K_DMSO"))

 

ADD REPLY
0
Entering edit mode

The default model in DESeq2 (and in R) is to build a design matrix where the first level of the factor is the level that is compared against. But it doesn't matter. When you use DESeq2 and specify `contrast`, the software takes care of this for you, adding and subtracting the correct coefficients to give you the contrast you want. So you don't have to worry about resultsNames() says if you use contrast.

ADD REPLY

Login before adding your answer.

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