This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Specify coefficient results group on dds in DESEq2

I would like to plot differentially expressed genes between two specific groups (1 and 7) however as explained here http://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.htmlmy "group five" is been picked alphabetically as the one to compare to. How can I select the group to which you want all the others to compare to? (Group one)

resultsNames(dds)
[1] "Intercept"              "group_four_vs_five"  "group_one_vs_five"   "group_seven_vs_five" "group_six_vs_five"  
[6] "group_three_vs_five" "group_two_vs_five"

I am aware you can do selective contracts between two groups:

res17<- results(dds, contrast=c("group","one","seven"), test="Wald")
plotMA(res17, ylim=c(-2,2))

which at the moment does not exist:

coef %in% resultsNamesDDS is not TRUE

but if I'd like to do Shrinkage and plotMA and others selecting dds, I need to select the "group_one_vs_seven" contrast

So instead of having to specify the contrast every time, or I run into some limitations such as:

res17 <- lfcShrink(dds,  contrast = c('group','one','seven'), res=res, type = "apeglm")

Error in lfcShrink(dds, ... type='apeglm' shrinkage only for use with 'coef'

can I specify it initially at the dds and have it as a coefficient when running these?

res17 <- lfcShrink(dds, coef="group_one_vs_seven", type="apeglm")
deseq2 rna-seq r

1 answer

You can relevel your factor variable and specify your group 1 in the first position instead of group 5. For example, group1, group2, group3, group4, group5, group6, group7. This would natively include a coefficient comparing group7_vs_group1.

Do you mean to re-name my coldata so the group one is now group1 and the program will then take it as default control to compare against?

that is a possibility, but I think thyleal meant to use the relevel R function to reorder your levels. See ?relevel.

Yes, exactly what @Carlo said. If you need to control all levels, just use x <- factor(y, levels = c(level1, level2, level3, leveln))

Couldn't OP also just use contrasts and then use ashr as the shrinkage estimator?

Log in to answer this question.