Entering edit mode
Hello,
I am running DESeq2 with this metadata table -
Condition | Time | Batch |
---|---|---|
Control | 0h | 1 |
Control | 12h | 1 |
Control | 24h | 1 |
Control | 0h | 2 |
Control | 12h | 2 |
Control | 24h | 2 |
Control | 0h | 3 |
Control | 12h | 3 |
Control | 24h | 3 |
Control | 0h | 4 |
Control | 12h | 4 |
Control | 24h | 4 |
Treated | 12h | 1 |
Treated | 24h | 1 |
Treated | 12h | 2 |
Treated | 24h | 2 |
Treated | 12h | 3 |
Treated | 24h | 3 |
Treated | 12h | 4 |
Treated | 24h | 4 |
When I try to do the interactions, I get the error - "Error in solve.default(qr.R(qrx)) : 'a' (1 x 0) must be square" I would like to model interactions between condition and time, but I also noticed that the data has batch effects using the plotPCA function.
This is what my code looks like.
m1 <- model.matrix(~ Condition +Time + Batch, colData(dds)) # This works but doesn't contain the interaction I want
dds <- DESeqDataSetFromMatrix(countData = counts, colData = metadata, design = ~1)
m1 <- model.matrix(~ Condition + Condition:Batch + Condition:Time, data = metadata)
all.zero <- apply(m1, 2, function(x) all(x==0))
all.zero
idx <- which(all.zero)
m1 <- m1[,-idx]
dds <- DESeq(dds, test = "Wald", betaPrior = FALSE, full = m1, parallel = TRUE)
using supplied model matrix
estimating size factors
estimating dispersions
gene-wise dispersion estimates
Error in solve.default(qr.R(qrx)) : 'a' (1 x 0) must be square
- Would it make sense to replicate the control 0h as treated 0h?
- I saw another post here where another user posted a similar error. How do I change the design in my experiment so it works?
Thank you! Priyanka