Hello,
I have some questions about running a likelihood ratio test in the DESeq2 package in R. My experiment has two factors: sex and population, with 8-12 replicates per condition. I wish to identify genes that show an interaction between sex and population (specifically, genes with a sexually dimorphic expression in populations A and B, but not populations C and D).
Unfortunately, I'm not sure that I've set up the code properly, as my LRT results don't seem to corroborate with the results from some of my more heuristic methods.
Can anyone tell me if I'm making any glaring mistakes in my code?
countData <- read.table ("Counttable.txt", header=TRUE)
stickleDesign = data.frame (
row.names = colnames(countData),
sex = c("M", "F", "M", cont... )
pop = c("A", "A", "B", cont... )
library("DESeq2")
dds <- DESeqDataSetFromMatrix (countData=countData,
colData=stickleDesign,
design = ~sex)
dds <- DESeq(dds)
# Multi-Factor Analysis
design(dds) <- formula(~ sex + pop + sex:pop)
dds <- DESeq(dds, test=c("LRT"), full=~ sex + pop + sex:pop, reduced=~sex + pop)
resMFType <- results(dds, contrast=c("sex","M","F"))
Additionally, how do I tell that the model with the interaction term is necessarily better than one without? Is there an objective way to tell? I guess I was expecting a single p-value to represent the effectiveness of the model, but I don't see that I'm provided with anything like that.
Thanks for the help!
Will
Hi Michael, Is this still true in the current version? Should I refrain from using the "contrast" argument when using LRT instead of the wald test? If so, how are my log2 fold changes calculated? First category in the factor compared to the others in alphabetical order?
If you use 'contrast' and want to test the contrast, you have to specify test="Wald"
If you use contrast, the only change will be the LFC. See the section of ?results that discusses LRT and p-values.
See the vignette regarding factor levels.
Thanks, that clarifies things.