I am trying to extract results from a DESeqDataSet object based on a customized contrast list. Depending on whether the design contains an interaction term, the effect/result names change, which makes it quite difficult to extract results in an automatic fashion (e.g. as part of a script or app, without checking resultsNames() manually). Here's an example based on ?results:
library(DESeq2) dds <- makeExampleDESeqDataSet(n=100,m=24) dds$genotype <- factor(rep(rep(c("I","II","III"),each=4),2)) design(dds) <- ~ genotype + condition dds <- DESeq(dds) resultsNames(dds) #  "Intercept" "genotypeI" "genotypeII" "genotypeIII" "conditionA" "conditionB"
# genotypeI compared to average of genotypeII and genotypeIII results(dds, contrast=list("genotypeI", c("genotypeII", "genotypeIII")), listValues=c(1, -0.5)) # works!
However, when adding an interaction term, pairwise effects (_vs_) instead of individual effects are extracted, which makes it difficult to extract results for individual levels or customized contrasts:
design(dds) <- ~ genotype + condition + genotype:condition dds <- DESeq(dds) resultsNames(dds) #  "Intercept" "genotype_II_vs_I" "genotype_III_vs_I" "condition_B_vs_A" "genotypeII.conditionB" "genotypeIII.conditionB"
results(dds, contrast=list("genotypeI", c("genotypeII", "genotypeIII")), listValues=c(1, -0.5)) # error
Additionally, there seems to be no way to extract results for e.g. genotypeI.conditionA vs ...
DESeq(dds, modelMatrixType="expanded") requires a beta prior, but betaPrior=TRUE results in: Error in designAndArgChecker(object, betaPrior) : betaPrior=FALSE should be used for designs with interactions
Is there a way to directly influence which effects are calculated (e.g. genotypeI and genotypeII instead of genotype_II_vs_I, or genotypeII.conditionA instead of genotypeII.conditionB)? (For cases where resultsNames(dds) are not checked manually)