Body: <p>Brain data, particualrly human brain data have very heterogeneus cell types, so it's important to normalise by cell type/add proportoins of different cell types to the formula when performing differential expression. We have some bulk RNA-seq brain data from disease samples and wildtypes. I have used the package BrainInABlender to get a matrix of the proportions of each cell type in each sample</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Cell type</th>
  <th>Sample_1</th>
  <th>Sample 2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Neuron</td>
  <td>0.5</td>
  <td>0.7</td>
  </tr>
  <tr>
  <td>Microglia</td>
  <td>0.5</td>
  <td>0.3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The rows are the types of cells, the columns are the samples. I wanted to know what's the best way to add this as a confounding variable in Enrichment Browser (or if that's not possible in DESeq2).</p>
  <p>Edit: Current way I've tried to correct for this is in DESeq2. I have transposed the matrix of cell type proportoins then set DESeq's formula:</p>
  <pre><code>~ Condition + Condition:Neuron:Microglia:etc
  </code></pre>
  <p>This has drastically reduced the number of genes found to be differentially expressed but I don't know if it's the right way to do it.</p>
  <p>Edit 2: When I tried removing the interaction terms, replacing them with +</p>
  <pre><code>~ Condition + Neuron + Microglia etc
  </code></pre>
  <p>As suggested <a href="https://support.bioconductor.org/p/76265/" rel="nofollow noreferrer">on the Bioconductor support section</a> the number of genes went up by an order of magnitude from just using condition which is the opposite of what should have happened. This persisted whether condition was at the start or end of my formula.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-08T18:43:00.600Z
Comments.Text: What have you tried? DESeq2 works with count data not decimal numbers. What is your biological question/goal?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-09T01:42:30.650Z
Comments.Text: I have no idea what is an enrichment browser. If you are referring to RNAseq analysis,  in DESeq2, when you set up the data with colData = ... just add the cell type neuron / microglia as a numeric column?
Comments.UserDisplayName: StupidWolf
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-09T17:22:45.757Z
Comments.Text: @llrs Sorry for not being clear eough. I have a seperate matrix of count data. I also have this matrix which has the proportoins of each cell type in each sample. My goal was to best correct for differences in proportoins of cell types in each sample.
Comments.UserDisplayName: Sethzard
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-09T17:25:22.280Z
Comments.Text: @StupidWolf Enrichment Browser is an R package that allows for running several differential expression methods easily. I have added it to the coldata and seperated with : in my formula (Condition:Neuron:Microglia:etc but have no idea if that's right.
Comments.UserDisplayName: Sethzard
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-10T21:53:25.050Z
Comments.Text: @Sethzard this doesn't solve the last question. Correct for differences in proportion of cell types for what? To see what cell type express?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-01-11T11:42:17.057Z
Comments.Text: @llrs Different types of cells express genes at different levels. Brain samples vary significantly in the proportions of cell types from one sample to the next. A sample containing a higher proportion of one cell type may report changes associated with differences in cell types rather than true differential expression unless samples are normalised or changes in those proportoins are corrected for. We have brain samples from a control group and a disease group and want to work out the truly differential expressed genes. I've edited the post to try to clarify too.
Comments.UserDisplayName: Sethzard
Tags: <r><differential-expression><deseq2>
Title: Adding matrix as a confounder in EnrichmentBrowser
ThreadText: # Adding matrix as a confounder in EnrichmentBrowser
  
  (Asked by: username_0 on 2021-01-08)
  
  Brain data, particualrly human brain data have very heterogeneus cell types, so it's important to normalise by cell type/add proportoins of different cell types to the formula when performing differential expression. We have some bulk RNA-seq brain data from disease samples and wildtypes. I have used the package BrainInABlender to get a matrix of the proportions of each cell type in each sample
  
  | Cell type | Sample\_1 | Sample 2 |
  | --- | --- | --- |
  | Neuron | 0.5 | 0.7 |
  | Microglia | 0.5 | 0.3 |
  
  The rows are the types of cells, the columns are the samples. I wanted to know what's the best way to add this as a confounding variable in Enrichment Browser (or if that's not possible in DESeq2).
  
  Edit: Current way I've tried to correct for this is in DESeq2. I have transposed the matrix of cell type proportoins then set DESeq's formula:
  
  ```
  ~ Condition + Condition:Neuron:Microglia:etc
  
  ```
  
  This has drastically reduced the number of genes found to be differentially expressed but I don't know if it's the right way to do it.
  
  Edit 2: When I tried removing the interaction terms, replacing them with +
  
  ```
  ~ Condition + Neuron + Microglia etc
  
  ```
  
  As suggested [on the Bioconductor support section](https://support.bioconductor.org/p/76265/) the number of genes went up by an order of magnitude from just using condition which is the opposite of what should have happened. This persisted whether condition was at the start or end of my formula.
  
  **Tags:** r, differential-expression, deseq2
  
  > **Comments:**
  > **username_1**: What have you tried? DESeq2 works with count data not decimal numbers. What is your biological question/goal?  
  > **username_2**: I have no idea what is an enrichment browser. If you are referring to RNAseq analysis,  in DESeq2, when you set up the data with colData = ... just add the cell type neuron / microglia as a numeric column?  
  > **username_0**: @username_1 Sorry for not being clear eough. I have a seperate matrix of count data. I also have this matrix which has the proportoins of each cell type in each sample. My goal was to best correct for differences in proportoins of cell types in each sample.  
  > **username_0**: @username_2 Enrichment Browser is an R package that allows for running several differential expression methods easily. I have added it to the coldata and seperated with : in my formula (Condition:Neuron:Microglia:etc but have no idea if that's right.  
  > **username_1**: @username_0 this doesn't solve the last question. Correct for differences in proportion of cell types for what? To see what cell type express?  
  > **username_0**: @username_1 Different types of cells express genes at different levels. Brain samples vary significantly in the proportions of cell types from one sample to the next. A sample containing a higher proportion of one cell type may report changes associated with differences in cell types rather than true differential expression unless samples are normalised or changes in those proportoins are corrected for. We have brain samples from a control group and a disease group and want to work out the truly differential expressed genes. I've edited the post to try to clarify too.  
  
  ---
  
  ## 0 answers
  
  