Answers.Body: <p>Cleaning data before doing analysis can be more important than the method of data analysis. For UMIs, there's an obvious cleaning step that can be done: it would be better to filter out duplicates (prior to generating counts) than to try to incorporate that information in the count analysis.</p>
  
  <p>I'm not familiar with single cell analysis, but I am aware that DESeq2 can be <a href="https://t.co/KsUpczFn21" rel="nofollow noreferrer">adapted</a> to work with single cells, and incorporating additional variation is just a matter of adding an <a href="https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#multi-factor-designs" rel="nofollow noreferrer">additional covariate</a> into the DESeq2 formula model.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T09:44:10.963Z
Answers.Text: Thank you for your answer. In the meantime i found out that a linear regression is commonly used, but a negative binomial would be the favorable way to go.
Answers.UserDisplayName: DCZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-18T22:34:11.617Z
Answers.LastActivityDate: 2018-04-18T22:34:11.617Z
Answers.UserDisplayName: gringer
Answers.Body: <p>Seurat has as part of its protocol a step where you filter based on UMI counts and percent mitochondrial</p>
  
  <p><a href="http://satijalab.org/seurat/pbmc3k_tutorial.html" rel="nofollow noreferrer">http://satijalab.org/seurat/pbmc3k_tutorial.html</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-25T13:13:47.713Z
Answers.Text: Yes, but it uses a linear regression as a default. My question is specifically why a linear or a negative binomial regression.
Answers.UserDisplayName: DCZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-24T16:16:37.890Z
Answers.LastActivityDate: 2018-04-24T16:16:37.890Z
Answers.UserDisplayName: swbarnes2
Answers.Body: <p>If you just want to filter UMI related problems and cells with high mitochondrial to nuclear ratio, maybe there is no need to use modeling.</p>
  
  <ul>
  <li><p><strong>For UMIs</strong>: You can <strong>filter UMIs</strong> that are <strong>not supported by at least x reads</strong> (for instance 3 reads) and that probably arise from sequencing errors.</p></li>
  <li><p><strong>For high mitochondrial to nuclear ratio</strong>: You can compute (number of molecules of mitochondrial genes / number of molecules of nuclear genes) and plot this ratio for all the cells and try to put a <strong>threshold value for cells that have high values for this ratio</strong>. Thus, filter these cells that behave strange compared to the rest.</p></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T09:40:03.653Z
Answers.Text: Thank you for your reply. I know these are standard threshold protocols, mostly dealing with badly sequenced cells or dying cells, however, this is not a correction for amplifcation bias. So I don't think this answer is what i'm looking for.
Answers.UserDisplayName: DCZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T12:36:25.540Z
Answers.Text: @DCZ I was following the Seurat tutorial for clustering cells (http://satijalab.org/seurat/pbmc3k_tutorial.html) when I found something very similar to your question. Literally, in the removing unwanted source of variation step: "In this simple example here for post-mitotic blood cells, we regress on the number of detected molecules per cell as well as the percentage mitochondrial gene content." It seems that they used a linear model, extracted from Buettner et al., 2015 (https://www.nature.com/articles/nbt.3102). Is this what you are looking for?. They even have an implemented function.
Answers.UserDisplayName: jxx_fa
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T12:40:17.090Z
Answers.Text: That's correct. The Seurat tutorial indeed does this, but the scaleData function uses a linear regression by default. As count data follows a negative binomial distribution, this seemed a peculiar choice to me.
Answers.UserDisplayName: DCZ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-19T09:36:20.867Z
Answers.LastActivityDate: 2018-04-19T09:36:20.867Z
Answers.UserDisplayName: jxx_fa
Body: <p>I have a dataset of single cell count data and I want to regress out the variation caused by the number of UMI's and the percentage of mitochondrial genes.</p>
  
  <p>I know that count data is discrete data, and commonly follows a negative binomial distribution. To regress out these two confounders, should I use a linear model or GLM (poisson/negative binomial)? And how can I determine the optimal choice?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-19T09:59:19.017Z
Comments.Text: What do you mean by `single cell count data`? If you mean mRNA counts, then your data are compositional and should be treated as such.
Comments.UserDisplayName: Eli Korvigo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-19T10:02:05.257Z
Comments.Text: yes mRNA counts, as I mentioned in the title. What regression technique is applicable for compositional data?
Comments.UserDisplayName: DCZ
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-19T10:10:36.700Z
Comments.Text: If I understand you correctly, "I want to regress out the variation caused by the number of UMI's and the percentage of mitochondrial genes" means that you want to mitigate the constrained geometry arising from multinomial sampling (aka the unit-sum problem). There are multiple transforms that can alleviate certain effects of compositionality (alr, clr, iqlr) or project the data into an unconstrained Euclidean space (ilr). The choice depends on subsequent analyses and their properties. ALDEx2, a widely used RNA-seq package, uses clr and iqlr. Take note, that they all assume certain properties.
Comments.UserDisplayName: Eli Korvigo
Tags: <rna-seq><scrnaseq><single-cell><linear-regression>
Title: Regressing out unwanted sources of variation in single cell RNA-seq data
ThreadText: # Regressing out unwanted sources of variation in single cell RNA-seq data
  
  (Asked by: username_0 on 2018-04-18)
  
  I have a dataset of single cell count data and I want to regress out the variation caused by the number of UMI's and the percentage of mitochondrial genes.
  
  I know that count data is discrete data, and commonly follows a negative binomial distribution. To regress out these two confounders, should I use a linear model or GLM (poisson/negative binomial)? And how can I determine the optimal choice?
  
  **Tags:** rna-seq, scrnaseq, single-cell, linear-regression
  
  > **Comments:**
  > **username_1**: What do you mean by `single cell count data`? If you mean mRNA counts, then your data are compositional and should be treated as such.  
  > **username_0**: yes mRNA counts, as I mentioned in the title. What regression technique is applicable for compositional data?  
  > **username_1**: If I understand you correctly, "I want to regress out the variation caused by the number of UMI's and the percentage of mitochondrial genes" means that you want to mitigate the constrained geometry arising from multinomial sampling (aka the unit-sum problem). There are multiple transforms that can alleviate certain effects of compositionality (alr, clr, iqlr) or project the data into an unconstrained Euclidean space (ilr). The choice depends on subsequent analyses and their properties. ALDEx2, a widely used RNA-seq package, uses clr and iqlr. Take note, that they all assume certain properties.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2018-04-18. Score: 2
  
  Cleaning data before doing analysis can be more important than the method of data analysis. For UMIs, there's an obvious cleaning step that can be done: it would be better to filter out duplicates (prior to generating counts) than to try to incorporate that information in the count analysis.
  
  I'm not familiar with single cell analysis, but I am aware that DESeq2 can be [adapted](https://t.co/KsUpczFn21) to work with single cells, and incorporating additional variation is just a matter of adding an [additional covariate](https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#multi-factor-designs) into the DESeq2 formula model.
  
  > **Comments:**
  > **username_0**: Thank you for your answer. In the meantime i found out that a linear regression is commonly used, but a negative binomial would be the favorable way to go.  
  
  ---
  
  ### Answer by username_3 on 2018-04-24. Score: 2
  
  Seurat has as part of its protocol a step where you filter based on UMI counts and percent mitochondrial
  
  <http://satijalab.org/seurat/pbmc3k_tutorial.html>
  
  > **Comments:**
  > **username_0**: Yes, but it uses a linear regression as a default. My question is specifically why a linear or a negative binomial regression.  
  
  ---
  
  ### Answer by username_4 on 2018-04-19. Score: 0
  
  If you just want to filter UMI related problems and cells with high mitochondrial to nuclear ratio, maybe there is no need to use modeling.
  
  * **For UMIs**: You can **filter UMIs** that are **not supported by at least x reads** (for instance 3 reads) and that probably arise from sequencing errors.
  * **For high mitochondrial to nuclear ratio**: You can compute (number of molecules of mitochondrial genes / number of molecules of nuclear genes) and plot this ratio for all the cells and try to put a **threshold value for cells that have high values for this ratio**. Thus, filter these cells that behave strange compared to the rest.
  
  > **Comments:**
  > **username_0**: Thank you for your reply. I know these are standard threshold protocols, mostly dealing with badly sequenced cells or dying cells, however, this is not a correction for amplifcation bias. So I don't think this answer is what i'm looking for.  
  > **username_4**: @username_0 I was following the Seurat tutorial for clustering cells (http://satijalab.org/seurat/pbmc3k_tutorial.html) when I found something very similar to your question. Literally, in the removing unwanted source of variation step: "In this simple example here for post-mitotic blood cells, we regress on the number of detected molecules per cell as well as the percentage mitochondrial gene content." It seems that they used a linear model, extracted from Buettner et al., 2015 (https://www.nature.com/articles/nbt.3102). Is this what you are looking for?. They even have an implemented function.  
  > **username_0**: That's correct. The Seurat tutorial indeed does this, but the scaleData function uses a linear regression by default. As count data follows a negative binomial distribution, this seemed a peculiar choice to me.  
  
  ---
  
  