I would like to know how to apply lfcShrink to different contrasts where I have 4 groups in my model (LOCHYcontrol, LARUcontrol, LOCHYpolyIC and LARU polyIC).
The contrasts I am interested in are;
- LOCHYcontrol vs LARUcontrol
- LOCHYpolyIC vs LARUpolyIC
- LOCHYcontrol vs LOCHYpolyIC
- LARUcontrol vs LARUpolyIC
When I run the model and look at the resultsNames, I am not sure how to then apply lfcShrink to the contrasts I am interested in as only one of these appears in the resultsNames (site_treat_LOCHYpolyIC_vs_LOCHYcontrol).
Is there a way to access all possible contrasts with lfcSkrink?
### create agglomerated variable ###
coldata$site_treat <- as.factor(paste(coldata$site, coldata$treatment, sep=""))
coldata$site_treat <- relevel(coldata$site_treat, "LOCHYcontrol","LARUcontrol","LOCHYpolyIC","LARUpolyIC")
coldata
### using agglomerated variable to model counts, so 4 levels ###
dds_new <- DESeqDataSetFromMatrix(countData = counts,
colData = coldata,
design = ~ site_treat)
dds_new
### run DESeq analysis ###
dds_new <- DESeq(dds_new)
resultsNames(dds_new)
## [1] "Intercept"
## [2] "site_treat_LARUcontrol_vs_LOCHYcontrol"
## [3] "site_treat_LARUpolyIC_vs_LOCHYcontrol"
## [4] "site_treat_LOCHYpolyIC_vs_LOCHYcontrol"
### to run lfc shrinkage after the fact ###
resLFC <- lfcShrink(dds_new, coef=4, type="apeglm")
resLFC