How do I get pair-wise comparisons between samples in a multi-factor and multi-level dataset with DESeq?
I have two factors of treatment and time. 2 treatment levels and 3 time levels.
This is a rough code of what I did so far in R:
countData = read.table('...')
treatments = factor(c('H','H','H','H','H','H','T','T','T','T','T','T'))
time = factor(c('00','00','01','01','02','02','00','00','01','01','02','02'))
design = data.frame(treatment,time)
countObject = newCountDataSet(countData, design)
countObject = estimateSizeFactors(countObject)
countObject = estimateDispersions(countObject, method="pooled" )
fit0 = fitNbinomGLMs(countObject, count ~ treatment)
fit1 = fitNbinomGLMs(countObject, count ~ treatment + time)
Now I assume I need to use the nbinomGLMs function to get differential expression in time while accounting for treatment. I have 3 time points here. How do I do 00 - 01, 01 - 02, 00 - 02 for both treatments.
So for example what are the DE genes between treatment H, time 00 to treatment H, time 01; or DE genes between treatment H, time 01 to treatment T, time 01.
What would be the difference if I did this instead:
fit0 = fitNbinomGLMs(countObject, count ~ time)
fit1 = fitNbinomGLMs(countObject, count ~ time + treatment)
Is one looking at DE between treatments while accounting for time and the other looking at DE among time while accounting for treatment?
Am I even using DESeq's multi-factor method correctly?
Thanks Steve. edgeR's explanations seem a lot clearer. I guess I'll switch over.