Error in checkFullRank(modelMatrix) deseq2 Trying to use deseq2 for differential expression analysis (rna-seq) between three groups and also account for batch effect as the control were sequenced at a different time point.


control: con 
sample with mutation A: mutA 
sample with mutation B: mutB


here is my design 

   sample condition batch
1     C_1         con     1
2     C_2         con     1
3     C_5         con     1
4     C_3         con     1
5     C_4         con     1
6     M_6        mutA     2
7     M_2        mutA     2
8     M_5        mutA     2
9     M_1        mutA     2
10    M_4        mutA     2
11    M_3        mutA     2
12   MA_2        mutB     2
13   MA_6        mutB     2
14   MA_5        mutB     2
15   MA_4        mutB     2
16   MA_3        mutB     2
17   MA_1        mutB     2 


when i create matrix:

dds &lt;- DESeqDataSetFromMatrix(countData = data, colData = coldata, design = ~batch + condition)


I see this error:

Error in checkFullRank(modelMatrix) : 
  the model matrix is not full rank, so the model cannot be fit as specified.
  One or more variables or interaction terms in the design formula are linear
  combinations of the others and must be removed.


I also tried to compare only two conditions subsetting the original data, i still see the same error what am i missing?
See the second example from the vignette, which is exactly your situation. The software cannot differentiate between the batch effects vs. condition effects because the groups are exactly the same.