DESeq2 use of factors for colData
1
0
Entering edit mode
5 weeks ago
mcsimenc ▴ 20

Hi, I am doing differential expression analysis using a count matrix with four samples and two groups using the function:

DESeqDataSetFromMatrix(countMatrix, colData = colData, design = ~groups.

I set the corresponding rows in my colData$groups to c("ctl", "ctl", "trt", "trt"), and I get one result, same as if I set colData$groups to c(0,0,1,1). But if I set it to c(0,0,2,2), I get a different result. However, if I set colData$groups to factor(c(0,0,2,2)) I get the same results as 0,0,1,1. What is DESeqDataSetFromMatrix doing to give the different results for colData$groups 0,0,2,2?

Thank you

DESeq2 expression differential • 269 views
0
Entering edit mode
5 weeks ago

If you don't want the groups to be literal numbers, making them factors is the correct thing to do.

DESeq2 tends to do this automatically if you give it strings for the colData, but it won't do that if you give it numbers.

0
Entering edit mode

Thanks for your answer. Do you know what DESeq2 is doing when given numbers?

0
Entering edit mode

I believe it will try to make a linear correlation between the logs of the counts and your numerical colData. But it's hard to know without seeing the rest of your code.