Entering edit mode
Hi, I have(almost) a similar data than:
| Group | Donor | Condition | Age | Donor_nested |
|--------|-------|-----------|-----|--------------|
| X | 1 | KO | 60 | 1 |
| X | 1 | WT | 60 | 1 |
| X | 2 | KO | 50 | 2 |
| X | 2 | WT | 50 | 2 |
| Y | 3 | KO | 65 | 1 |
| Y | 3 | WT | 65 | 1 |
| Y | 4 | KO | 55 | 2 |
| Y | 4 | WT | 55 | 2 |
| Y | 5 | KO | 45 | 3 |
| Y | 5 | WT | 45 | 3 |
My goal is to find DEGs KO vs WT for each Group separately, and accounting for batch effect.
However, as you can see I have more donors in my Y group than my X group.
I tried to create a dds object:
dds <- DESeqDataSetFromMatrix(data, colData = meta, design = ~ Group + Group:Donor_nested + Group:Condition)
But got this error:
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.
Do you have any solution ? Thanks
What happens if you remove the columns of all zeros?
The problem is that donor 4 is nested with condition since it is KO for both the donor 4 samples. Removing that and then making a new donor_nested column should solve it.
sorry I made a typo in my table (now edited). The donor 4 actually has the 2 conditions: KO and WT.
I tried something, could it be the reason of the error ?
I first convert all columns to factor exept Age: