My design consists of one factor i.e. treatment with three levels
>dds <- phyloseq_to_deseq2(ps, ~treatment)
>levels(dds$treatment)
'Compost''Control''Forest''Groundnut'
>dds <- DESeq(dds, "LRT", reduced = ~ 1)
>resultsNames(dds)
'Intercept''treatment_Control_vs_Compost''treatment_Forest_vs_Compost''treatment_Groundnut_vs_Compost'
>lfcShrink(
dds,
res = results(
dds,
name = "treatment_Control_vs_Compost",
test = "Wald"
),
type = "apeglm",
coef = "treatment_Control_vs_Compost"
) %>%
data.frame() %>%
filter(padj <= 0.05 & abs(log2FoldChange) >= 1)
I then ran lfcShrink for my co-efficient of interest i.e treatment_Control_vs_Compost
and after filtering for padj <= 0.05 & abs(log2FoldChange) >= 1
, I ended up with 169 features. However, when I repeated this after changing the reference level to Control
, I get only 23 features for the same co-efficient
>dds$treatment <- relevel(dds$treatment, ref = "Control")
>dds <- nbinomWaldTest(dds)
>resultsNames(dds)
'Intercept''treatment_Compost_vs_Control''treatment_Forest_vs_Control''treatment_Groundnut_vs_Control'
>lfcShrink(
dds,
res = results(
dds,
name = "treatment_Compost_vs_Control",
test = "Wald"
),
type = "apeglm",
coef = "treatment_Compost_vs_Control"
) %>%
data.frame() %>%
filter(padj <= 0.05 & abs(log2FoldChange) >= 1)
I expected more or less the same results, but this kind of surprised me
In your second code chunk, I think that you need to use the following:
, not:
?
Thanks, Kevin. Yes, I did try setting my initial test set to Walds and the problem with lfcShrink (specifically with apeglm) still persists. I typically do the LRT first and then do Wald's for specific co-efficients
No, i was saying to use:
?
Yes, I tried both your suggestions, but still the same results. I am wondering what leads to different results from apeglm, for the same coefficient, based on which factor level is set as the reference