Answers.Body: <p>llrs is right.  "Matrix Model not full rank" means that two of your conditions are confounded.  You can't get your normals from one place and your experimentals from another</p>
  
  <p>And no, there generally is no clever way out of this.  For all you know, <strong>any</strong> differences you see between your normals and your cancers are 100% due to being sequenced somewhere else, and have nothing to do with real biology.</p>
  
  <p>If you want to run this through DESeq, drop batch effect.  But tell whoever you are reporting the results to that batch is hopelessly confounded with cancer state, and you can't tell which differences are due to what.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-25T15:02:23.600Z
Answers.Text: Sorry I was designing an expensive RNA-seq experiment so I must be wise before invest any money; could I please ask you if the design gives what I want? You please imagine I have 1- fibroblast surrounding the tumor, 2- tumor itself and 3 - I have co-cultured  fibroblast  with tumor; My ultimate goal is getting genes coming from the interaction of fibroblast and tumor, so I am going to use DESeq2 to for differential expression the condition would be co-culture vs fibroblast + tumor; Do you think this is right?
Answers.UserDisplayName: Zizogolu
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-21T16:40:16.270Z
Answers.LastActivityDate: 2019-03-21T16:40:16.270Z
Answers.UserDisplayName: swbarnes2
Body: <p>I have 3 tumour samples from 3 patients from an experiment, I also downloaded 10 normal samples from TCGA. My design is like this </p>
  
  <pre><code>&gt; mycols
                 condition batch
  normal1           normal     1
  normal2           normal     1
  normal3           normal     1
  normal4           normal     1
  normal5           normal     1
  normal6           normal     1
  normal7           normal     1
  normal8           normal     1
  normal9           normal     1
  normal10          normal     1
  OESO_036_a_RNA    cancer     2
  OESO_013_a_RNA    cancer     2
  OESO_005_a_RNA    cancer     2
  &gt;
  </code></pre>
  
  <p>But DESeq2 returns error when trying for differential expression analysis</p>
  
  <pre><code>&gt; dds &lt;- DESeqDataSetFromMatrix(countData=counts, colData=mycols, design=~batch+condition)
  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.
  
    Please read the vignette section 'Model matrix not full rank':
  
    vignette('DESeq2')
  In addition: Warning message:
  In DESeqDataSet(se, design = design, ignoreRank) :
    some variables in design formula are characters, converting to factors
  </code></pre>
  
  <p>Then how I could extract deferentially expressed genes between tumour and normal samples while they are coming from two different batches?</p>
  
  <p>Any help please?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-21T15:12:06.807Z
Comments.Text: Did you read the vignette section "Model matrix not full rank"? The problem here is that there is no way you can distinguish the effect of being normal and the effect of being sequenced on batch 1, you have the two effects affecting the same samples!
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-21T16:23:24.640Z
Comments.Text: There should be a solution for this case , is not it?
Comments.UserDisplayName: Zizogolu
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-21T16:37:14.900Z
Comments.Text: Not unless you have some normal and cancer samples that you can resequence in a third batch. (But perhaps you don't have a batch effect, but I wouldn't bet anything on this)
Comments.UserDisplayName: llrs
Tags: <r><rna-seq><deseq2>
Title: Differential expression analysis when nested effects
ThreadText: # Differential expression analysis when nested effects
  
  (Asked by: username_0 on 2019-03-21)
  
  I have 3 tumour samples from 3 patients from an experiment, I also downloaded 10 normal samples from TCGA. My design is like this
  
  ```
  > mycols
                 condition batch
  normal1           normal     1
  normal2           normal     1
  normal3           normal     1
  normal4           normal     1
  normal5           normal     1
  normal6           normal     1
  normal7           normal     1
  normal8           normal     1
  normal9           normal     1
  normal10          normal     1
  OESO_036_a_RNA    cancer     2
  OESO_013_a_RNA    cancer     2
  OESO_005_a_RNA    cancer     2
  >
  
  ```
  
  But DESeq2 returns error when trying for differential expression analysis
  
  ```
  > dds <- DESeqDataSetFromMatrix(countData=counts, colData=mycols, design=~batch+condition)
  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.
  
    Please read the vignette section 'Model matrix not full rank':
  
    vignette('DESeq2')
  In addition: Warning message:
  In DESeqDataSet(se, design = design, ignoreRank) :
    some variables in design formula are characters, converting to factors
  
  ```
  
  Then how I could extract deferentially expressed genes between tumour and normal samples while they are coming from two different batches?
  
  Any help please?
  
  **Tags:** r, rna-seq, deseq2
  
  > **Comments:**
  > **username_1**: Did you read the vignette section "Model matrix not full rank"? The problem here is that there is no way you can distinguish the effect of being normal and the effect of being sequenced on batch 1, you have the two effects affecting the same samples!  
  > **username_0**: There should be a solution for this case , is not it?  
  > **username_1**: Not unless you have some normal and cancer samples that you can resequence in a third batch. (But perhaps you don't have a batch effect, but I wouldn't bet anything on this)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-03-21. Score: 3
  
  username_1 is right. "Matrix Model not full rank" means that two of your conditions are confounded. You can't get your normals from one place and your experimentals from another
  
  And no, there generally is no clever way out of this. For all you know, **any** differences you see between your normals and your cancers are 100% due to being sequenced somewhere else, and have nothing to do with real biology.
  
  If you want to run this through DESeq, drop batch effect. But tell whoever you are reporting the results to that batch is hopelessly confounded with cancer state, and you can't tell which differences are due to what.
  
  > **Comments:**
  > **username_0**: Sorry I was designing an expensive RNA-seq experiment so I must be wise before invest any money; could I please ask you if the design gives what I want? You please imagine I have 1- fibroblast surrounding the tumor, 2- tumor itself and 3 - I have co-cultured  fibroblast  with tumor; My ultimate goal is getting genes coming from the interaction of fibroblast and tumor, so I am going to use DESeq2 to for differential expression the condition would be co-culture vs fibroblast + tumor; Do you think this is right?  
  
  ---
  
  