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.

  1. control: con
  2. sample with mutation A: mutA
  3. 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 <- 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?

  • $\begingroup$ can you please post the format which ran successfully in DESeq. I have a similar issue $\endgroup$ Commented Mar 11, 2023 at 7:44

1 Answer 1


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.

  • $\begingroup$ cannnot re do the experiment, use the nested column is it? $\endgroup$ Commented Feb 8, 2018 at 23:01
  • $\begingroup$ elegantly explained just had to a little more search, can i delete this question? $\endgroup$ Commented Feb 8, 2018 at 23:15
  • $\begingroup$ Sorry, I don't understand your question in the first comment. Sure, you can delete it if you'd like. $\endgroup$
    – Ken S.
    Commented Feb 9, 2018 at 0:49
  • 1
    $\begingroup$ no the link you posted has accurate answer, i had to do a little more research before posting a question how should i design was my question $\endgroup$ Commented Feb 9, 2018 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.