<p>I am new to bioinformatics and PCA. What I am trying to do is to remove bad cells from a dataset that was obtained with <code>scRNA-seq</code> for <code>46 000</code> of genes (rows) vs <code>68 000</code> of cells that are of different types of <code>C. Elegans</code> that was generated in the <a href="https://www.ncbi.nlm.nih.gov/pubmed/28818938" rel="nofollow noreferrer">following paper</a>.</p>

<p>After running <code>PCA</code>: </p>

<pre><code>fontsize &lt;- theme(axis.text=element_text(size=12), 
axis.title=element_text(size=16))
plotPCA(sce, pca_data_input="pdata") + fontsize
</code></pre>

<p>I see the following chart:</p>

<p><a href="https://i.sstatic.net/vRRkE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/vRRkE.png" alt="enter image description here"></a></p>

<p>I suppose that the cells that are going to the left bottom corner are the bad ones since they do not fall into some restricted region. Are there any <code>R</code> program that can automatically remove the bad cells leaving me with just the majority of cells clustered within an ellipse? I know there is <code>identify</code> method that allows for clicking and labelling manually cells that I think may be outliers (<a href="https://stackoverflow.com/questions/19683379/identifying-removing-outliers-from-pca-qq-plots">see this</a>) but I do not like it. I would prefer some program that would do that for me, giving some statistical output of the reliability of the removal of the cells.</p>

CC BY-SA 3.0
2017-12-17T23:56:46.850Z
I suspect something has gone wrong if 96% of your gene expression variance is in the first two components (and 87% in the first component). Have you normalised counts for each cell? Do you have the gene expression matrix oriented correctly? Have you transformed the expression to be in log space? Are you scaling the PCA such that each gene contributes the same amount to the variance?
gringer
CC BY-SA 3.0
2018-01-07T19:20:38.153Z
Thank you very much for the advice! I eliminated low-count genes, normalized the dataset, eliminated the low-count cells and PCA started to look much better in terms of PC1 and PC2 percentages, although still far from perfect and there is no separation into unique groups: https://bioinformatics.stackexchange.com/questions/3232/improve-scrna-seq-dataset-for-further-analysis
Nikita Vlasenko
CC BY-SA 3.0
2018-01-07T19:21:45.730Z
I still do not know the answer to this question
Nikita Vlasenko
CC BY-SA 3.0
2018-01-15T17:22:51.663Z
It is not an easy task to automatically identify outliers in a multivariate space. Have you tried to look at [this](https://cran.r-project.org/web/packages/mvoutlier/mvoutlier.pdf) or [this](https://stackoverflow.com/questions/41462073/multivariate-outlier-detection-using-r-with-probability) ?
Vincent Guillemot
<r><rna-seq><pca>
Filter out PCA outliers automatically
# Filter out PCA outliers automatically

(Asked by: username_0 on 2017-12-17)

I am new to bioinformatics and PCA. What I am trying to do is to remove bad cells from a dataset that was obtained with scRNA-seq for 46 000 of genes (rows) vs 68 000 of cells that are of different types of C. Elegans that was generated in the following paper.
After running PCA: 
fontsize <- theme(axis.text=element_text(size=12), 
axis.title=element_text(size=16))
plotPCA(sce, pca_data_input="pdata") + fontsize

I see the following chart:

I suppose that the cells that are going to the left bottom corner are the bad ones since they do not fall into some restricted region. Are there any R program that can automatically remove the bad cells leaving me with just the majority of cells clustered within an ellipse? I know there is identify method that allows for clicking and labelling manually cells that I think may be outliers (see this) but I do not like it. I would prefer some program that would do that for me, giving some statistical output of the reliability of the removal of the cells.

**Tags:** r, rna-seq, pca
> **Comments:**
> **username_1**: I suspect something has gone wrong if 96% of your gene expression variance is in the first two components (and 87% in the first component). Have you normalised counts for each cell? Do you have the gene expression matrix oriented correctly? Have you transformed the expression to be in log space? Are you scaling the PCA such that each gene contributes the same amount to the variance?  
> **username_0**: Thank you very much for the advice! I eliminated low-count genes, normalized the dataset, eliminated the low-count cells and PCA started to look much better in terms of PC1 and PC2 percentages, although still far from perfect and there is no separation into unique groups: https://bioinformatics.stackexchange.com/questions/3232/improve-scrna-seq-dataset-for-further-analysis  
> **username_0**: I still do not know the answer to this question  
> **username_2**: It is not an easy task to automatically identify outliers in a multivariate space. Have you tried to look at [this](https://cran.r-project.org/web/packages/mvoutlier/mvoutlier.pdf) or [this](https://stackoverflow.com/questions/41462073/multivariate-outlier-detection-using-r-with-probability) ?  

---

## 0 answers

