I'm running a DEG analysis with Deseq2 by specifing the following design that includes 12 samples from 6 pts in 4 different conditions:
coldata <- data.frame("sample"=c(
"T58", "T86", "T87",
"D58", "D86", "D87",
"C62", "C80", "C84",
"C62", "C80", "C84"
))
coldata$Pts <- c(
"m58", "m86", "m87",
"m58", "m86", "m87",
"c62", "c80", "c84",
"c62", "c80", "c84"
)
coldata$class <- c(
"Treated", "Treated", "Treated",
"Distal", "Distal", "Distal",
"CLEFT", "CLEFT", "CLEFT",
"CRIGHT", "CRIGHT", "CRIGHT"
)
I would model the differences among the conditions by considering that the same individuals are nested in different conditions
I tried the following code
ddsMat <- DESeqDataSetFromMatrix(
countData = as.matrix(matrix),
colData = coldata,
design = ~ class+Pts
)
but this produces the famous error
"the model matrix is not full rank..."
If I reduce the previous dataset to
coldata2 <- as.data.frame(c(
"T58", "T86", "T87",
"D58", "D86", "D87"
))
coldata2$Pts <- c(
"m58", "m86", "m87",
"m58", "m86", "m87"
)
coldata2$class <- c(
"Treated", "Treated", "Treated",
"Distal", "Distal", "Distal"
)
then everything goes well and I'm able to create a DESeq
object with the following design:
ddsMat <- DESeqDataSetFromMatrix(
countData = as.matrix(matrix[,1:6]),
colData = coldata2,
design = ~ class+Pts
)
Please can you provide to me some suggestion on how to solve the problem?
Thank you