# Filter out PCA outliers automatically

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.

• 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 Dec 17 '17 at 23:56
• 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: bioinformatics.stackexchange.com/questions/3232/… – Nikita Vlasenko Jan 7 '18 at 19:20
• I still do not know the answer to this question – Nikita Vlasenko Jan 7 '18 at 19:21
• It is not an easy task to automatically identify outliers in a multivariate space. Have you tried to look at this or this ? – Vincent Guillemot Jan 15 '18 at 17:22