text: user926: 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 <- 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?
  
  user2320: 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.
  
original_text: 926: <p>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.</p>
  
  <ol>
  <li>control: con </li>
  <li>sample with mutation A: mutA </li>
  <li>sample with mutation B: mutB</li>
  </ol>
  
  <p>here is my design </p>
  
  <pre><code>   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 
  </code></pre>
  
  <p>when i create matrix:</p>
  
  <pre><code>dds &lt;- DESeqDataSetFromMatrix(countData = data, colData = coldata, design = ~batch + condition)
  </code></pre>
  
  <p>I see this error:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>I also tried to compare only two conditions subsetting the original data, i still see the same error what am i missing?</p>
   2320: <p>See the second example from <a href="https://bioconductor.org/packages/3.7/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#model-matrix-not-full-rank" rel="nofollow noreferrer">the vignette</a>, which is exactly your situation. The software cannot differentiate between the batch effects vs. condition effects because the groups are exactly the same.</p>
  