Pair-Wise Comparison In Deseq With Multiple Factors And Levels
1
0
Entering edit mode
12.1 years ago

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?

deseq rna-seq • 6.3k views
ADD COMMENT
1
Entering edit mode
12.1 years ago

I suspect you might be missing an interaction term between time and treatment.

The edgeRUsersGuide has quite a few examples of how to setup a design matrix in different scenarios, which should also be applicable here (GLMs are GLMs, after all).

I think the entirety of Seciton 3.3 is relevant here. They introduce a simpler way to encode your design matrix by essentially combining all combinations of factors into one covariate (Section 3.3.1), but go on to describe how to setup the design matrix (and tests) in a more "sophisticated" manner.

ADD COMMENT
0
Entering edit mode

Thanks Steve. edgeR's explanations seem a lot clearer. I guess I'll switch over.

ADD REPLY

Login before adding your answer.

Traffic: 2000 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6