Hello Michael,
I'm really grateful that you posted the reply 8.5 years ago in With DESeq2 "Not full rank" Error with design ~ line + time + condition. I tried your 2 approaches with the current version of DESeq2 (v1.38.3) that I have installed, and each time I get the following error message, respectively: 1) "Error in checkFullRank(modelMatrix) : the model matrix is not full rank, so the model cannot be fit as specified. Levels or combinations of levels without any samples have resulted in column(s) of zeros in the model matrix."
2) " Error in designAndArgChecker(object, betaPrior) : full model matrix is less than full rank "
My design is slightly simpler than Cor's because I have no treatment. Therefore, I have a time series with multiple individuals sampled at each time point, with some time points missing from certain individuals. The design I was trying get working is:
~ time + ind.nested + time:ind.nested
I hope that I got the design right...
I am assuming that each individual has a slightly different reaction over time so I added the interaction.
I made sure to have time=0 for all individuals so that I can set that as intercept.
The simpler model without the interaction ( ~ time + ind.nested) works when I run DESeqDataSetFromMatrix() and DESeq(), so I'm assuming that it's the missing time points in some of the individuals that's causing the problem. I saw in in your github code that the lack of full rank error message is generated when qr(mm)$rank < ncol(mm), and I have the values 31 < 36 when I ran the 2 commands manually in R. (Sorry, I'm a bit lost about what this qr$rank is telling me.)
Here is part of the colData:
Sample ind.nested time
1 A 0
2 A 1
3 A 2
4 A 3
5 A 4
6 B 0
7 B 1
8 B 2
9 B 3
10 B 4
11 C 0
12 C 2
13 C 3
14 C 4
15 D 0
16 D 1
17 D 3
18 D 4
etc.
This is what I did:
1)
dds <- DESeqDataSetFromMatrix(countData = zCount, colData = z, design = ~1)
mm <- model.matrix(~ time + ind.nested + time:ind.nested, data=z)
mm <- as.data.frame(mm)[, colSums(mm) != 0] # remove columns with only zeros
design(dds) <- ~ time + ind.nested. + time:ind.nested
dds <- DESeq(dds, full=mm, betaPrior=FALSE)
I also tried:
2)
design(dds) <- ~ time + ind.nested + time1ind.nestedA + time2ind.nestedA + ...
dds <- DESeq(dds)
I tried to add as many details about the issue I'm encountering as I could in hopes that you could help me. I am at a loss about what to do to solve the problem, so I'm very grateful for your help.
Thank you very much for your time.
Erika
Hello Michael,
Thank you very much for your response back.
We wanted to take into account the individual-related stochasticity when measuring response over time but you are right in that we only have one sample per individual at each time point.
So, for future reference, do you mean that we can use a design such as:
~ time + individual + time:individual
only if we have the following type of data set, right?
Sample individual time
1 A 0
2 A 0
3 A 1
4 A 1
5 B 0
6 B 0
7 B 1
8 B 1
etc.
Erika
Yes you need replication to have individual specific effects.
Hello Michael,
Great! Now I understand. :-) Thank you very much for guiding me through and your advice! I'm really grateful for your help!