Chapter 15 Doublet detection

15.1 Overview

In single-cell RNA sequencing (scRNA-seq) experiments, doublets are artifactual libraries generated from two cells. They typically arise due to errors in cell sorting or capture, especially in droplet-based protocols (Zheng et al. 2017) involving thousands of cells. Doublets are obviously undesirable when the aim is to characterize populations at the single-cell level. In particular, doublets can be mistaken for intermediate populations or transitory states that do not actually exist. Thus, it is desirable to identify and remove doublet libraries so that they do not compromise interpretation of the results.

Several experimental strategies are available for doublet removal. One approach exploits natural genetic variation when pooling cells from multiple donor individuals (Kang et al. 2018). Doublets can be identified as libraries with allele combinations that do not exist in any single donor. Another approach is to mark a subset of cells (e.g., all cells from one sample) with an antibody conjugated to a different oligonucleotide (Stoeckius, Zheng, et al. 2017). Upon pooling, libraries that are observed to have different oligonucleotides are considered to be doublets and removed. These approaches can be highly effective but rely on experimental information that may not be available.

A more general approach is to infer doublets from the expression profiles alone (Dahlin et al. 2018). In this workflow, we will describe two purely computational approaches for detecting doublets from scRNA-seq data. The main difference between these two methods is whether or not they need cluster information beforehand. We will demonstrate the use of these methods on 10X Genomics data from a droplet-based scRNA-seq study of the mouse mammary gland (Bach et al. 2017).

## class: SingleCellExperiment 
## dim: 27998 2772 
## metadata(0):
## assays(2): counts logcounts
## rownames(27998): Xkr4 Gm1992 ... Vmn2r122 CAAA01147332.1
## rowData names(3): Ensembl Symbol SEQNAME
## colnames: NULL
## colData names(4): Barcode Sample Condition cluster
## reducedDimNames(2): PCA TSNE
## spikeNames(0):
## altExpNames(0):

15.2 Doublet detection with clusters

The doubletCluster() function identifes clusters with expression profiles lying between two other clusters (Bach et al. 2017). We consider every possible triplet of clusters consisting of a query cluster and two putative “source” clusters. Under the null hypothesis that the query consists of doublets from the two sources, we then compute a number of statistics:

  • The number of genes (N) that are differentially expressed in the same direction in the query cluster compared to both of the source clusters. Such genes would be unique markers for the query cluster and provide evidence against the null hypothesis. Clusters with few unique genes are more likely to be composed of doublets.
  • The ratio of the median library size in each source to the median library size in the query (lib.size fields). Doublet libraries are generated from a larger initial pool of RNA compared to libraries for single cells, and thus the former should have larger library sizes. Library size ratios much greater than unity are inconsistent with a doublet identity for the query.
  • The proportion of cells in the query cluster should also be reasonable - typically less than 5% of all cells, depending on how many cells were loaded onto the 10X Genomics device.

For each query cluster, the best pair of sources is identified based solely on the lowest N. (This means that any lib.size* above unity is not definitive evidence against a doublet identity for a query cluster, as there may be a pair of sources with slightly higher N but both lib.size* values below unity.) If more detail is necessary, the all.pairs field contains statistics on all possible source pairs for a given query cluster.

## DataFrame with 10 rows and 9 columns
##        source1     source2         N        best              p.value
##    <character> <character> <integer> <character>            <numeric>
## 6            2           1        13       Pcbp2  0.00128335511558163
## 2           10           3       109        Pigr 4.34789652975281e-21
## 4            6           5       111       Cotl1 1.09709177938907e-08
## 5           10           7       139        Gde1 9.30194891490462e-12
## 10           8           5       191       Krt18 5.54538512686982e-20
## 7            8           5       270    AF251705   3.296606994399e-24
## 9            8           5       295       Fabp4 2.21522585183651e-32
## 8           10           9       388      Col1a1 6.82663925811519e-32
## 1            8           6       513       Acta2  1.0729388961162e-24
## 3            6           5       530      Sapcd2 6.08573639287151e-16
##            lib.size1         lib.size2                prop
##            <numeric>         <numeric>           <numeric>
## 6  0.811530667107821 0.516398527647959  0.0303030303030303
## 2  0.619865457139945  1.41157884007746   0.288239538239538
## 4   1.54075065315746 0.688650990887657   0.163059163059163
## 5   1.12547422966596  1.16785416859443 0.00865800865800866
## 10 0.888432130231029 0.888514346789443 0.00865800865800866
## 7  0.856192060850963 0.856271293875287  0.0187590187590188
## 9  0.655624317437204 0.655684989685718  0.0115440115440115
## 8   1.12557838238016  1.52526374236535  0.0140692640692641
## 1  0.865449303219606  1.93648886753164   0.198412698412698
## 3  0.872951115604015  0.39017257563723   0.258297258297258
##                                    all.pairs
##                              <DataFrameList>
## 6       2:1:13:...,4:1:14:...,3:1:28:...,...
## 2   10:3:109:...,5:3:194:...,8:3:205:...,...
## 4   6:5:111:...,10:6:146:...,6:2:209:...,...
## 5  10:7:139:...,9:7:153:...,10:9:168:...,...
## 10   8:5:191:...,9:5:224:...,6:5:229:...,...
## 7   8:5:270:...,9:5:337:...,10:5:362:...,...
## 9   8:5:295:...,10:8:323:...,5:1:338:...,...
## 8  10:9:388:...,9:7:400:...,10:7:436:...,...
## 1    8:6:513:...,9:6:609:...,6:5:854:...,...
## 3    6:5:530:...,5:2:593:...,5:4:700:...,...

Clusters are then ranked by N in the output of doubletClusters(), allowing us to prioritize high-risk clusters that require careful investigation. If a more concrete threshold is necessary, we can identify clusters that have unusually low N using an outlier-based approach.

## [1] "6"

Examination of the output of doubletCluster() indicates that cluster 6 has the fewest unique genes and library sizes that are comparable to or greater than its sources. We see that every gene detected in this cluster is also expressed in either of the two proposed source clusters (Figure 15.1).

Heatmap of mean-centred and normalized log-expression values for the top set of markers for cluster 6 in the mammary gland dataset. Column colours represent the cluster to which each cell is assigned, as indicated by the legend.

Figure 15.1: Heatmap of mean-centred and normalized log-expression values for the top set of markers for cluster 6 in the mammary gland dataset. Column colours represent the cluster to which each cell is assigned, as indicated by the legend.

Closer examination of some known markers suggests that the offending cluster consists of doublets of basal cells (Acta2) and alveolar cells (Csn2) (Figure 15.2). Indeed, no cell type is known to strongly express both of these genes at the same time, which supports the hypothesis that this cluster consists solely of doublets rather than being an entirely novel cell type.

Distribution of log-normalized expression values for _Acta2_ and _Csn2_ in each cluster. Each point represents a cell.

Figure 15.2: Distribution of log-normalized expression values for Acta2 and Csn2 in each cluster. Each point represents a cell.

The strength of doubletCluster() lies in its simplicity and ease of interpretation. Suspect clusters can be quickly flagged based on the metrics returned by the function. However, it is obviously dependent on the quality of the clustering. Clusters that are too coarse will fail to separate doublets from other cells, while clusters that are too fine will complicate interpretation. The method is also somewhat biased towards clusters with fewer cells, where the reduction in power is more likely to result in a low N. (Fortunately, this is a desirable effect as doublets should be rare in a properly performed scRNA-seq experiment.)

15.3 Doublet detection by simulation

The other doublet detection strategy involves in silico simulation of doublets from the single-cell expression profiles (Dahlin et al. 2018). This is performed using the doubletCells() function from scran, which will:

  1. Simulate thousands of doublets by adding together two randomly chosen single-cell profiles.
  2. For each original cell, compute the density of simulated doublets in the surrounding neighbourhood.
  3. For each original cell, compute the density of other observed cells in the neighbourhood.
  4. Return the ratio between the two densities as a “doublet score” for each cell.

This approach assumes that the simulated doublets are good approximations for real doublets. The use of random selection accounts for the relative abundances of different subpopulations, which affect the likelihood of their involvement in doublets; and the calculation of a ratio avoids high scores for non-doublet cells in highly abundant subpopulations.

We see the function in action below. To speed up the density calculations, doubletCells() will perform a PCA on the log-expression matrix, and we perform some (optional) parametrization to ensure that the computed PCs are consistent with that from our previous analysis on this dataset.

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       0       8      21     395      49   39573

The highest doublet scores are concentrated in a single cluster of cells in the centre of Figure 15.3.

t-SNE plot of the mammary gland data set. Each point is a cell coloured according to its doublet density.

Figure 15.3: t-SNE plot of the mammary gland data set. Each point is a cell coloured according to its doublet density.

From the clustering information, we see that the affected cells belong to the same cluster that was identified using doubletCluster() (Figure 15.4), which is reassuring.

Distribution of doublet scores for each cluster in the mammary gland data set. Each point is a cell.

Figure 15.4: Distribution of doublet scores for each cluster in the mammary gland data set. Each point is a cell.

The advantage of doubletCells() is that it does not depend on clusters, reducing the sensitivity of the results to clustering quality. The downside is that it requires some strong assumptions about how doublets form, such as the combining proportions and the sampling from pure subpopulations. In particular, doubletCells() treats the library size of each cell as an accurate proxy for its total RNA content. If this is not true, the simulation will not combine expression profiles from different cells in the correct proportions. This means that the simulated doublets will be systematically shifted away from the real doublets, resulting in doublet scores that are too low.

Simply removing cells with high doublet scores will not be sufficient to eliminate real doublets from the data set. In some cases, only a subset of the cells in the putative doublet cluster actually have high scores, and removing these would still leave enough cells in that cluster to mislead downstream analyses. In fact, even defining a threshold on the doublet score is difficult as the interpretation of the score is relative. There is no general definition for a fixed threshold above which libraries are to be considered doublets.

We recommend interpreting the doubletCells() scores in the context of cluster annotation. All cells from a cluster with a large average doublet score should be considered suspect, and close neighbours of problematic clusters should also be treated with caution. In contrast, a cluster containing a small proportion of high-scoring cells is probably safe provided that any interesting results are not being driven by those cells (e.g., checking that DE in an interesting gene is not driven solely by cells with high doublet scores). While clustering is still required, this approach is more robust than doubletClusters() to the quality of the clustering as the scores are computed on a per-cell basis.

(As an aside, the issue of unknown combining proportions can be solved completely if spike-in information is available, e.g., in plate-based protocols. This will provide an accurate estimate of the total RNA content of each cell. To this end, spike-in-based size factors from Section 7.4 can be supplied to the doubletCells() function via the size.factors.content= argument. This will use the spike-in size factors to scale the contribution of each cell to a doublet library.)

15.4 Further comments

Doublet detection procedures should only be applied to libraries generated in the same experimental batch. It is obviously impossible for doublets to form between two cells that were captured separately. Thus, some understanding of the experimental design is required prior to the use of the above functions. This avoids unnecessary concerns about the validity of batch-specific clusters that cannot possibly consist of doublets.

It is also difficult to interpret doublet predictions in data containing cellular trajectories. By definition, cells in the middle of a trajectory are always intermediate between other cells and are liable to be incorrectly detected as doublets. Some protection is provided by the non-linear nature of many real trajectories, which reduces the risk of simulated doublets coinciding with real cells in doubletCells(). One can also put more weight on the relative library sizes in doubletCluster() instead of relying solely on N, under the assumption that sudden spikes in RNA content are unlikely in a continuous biological process.

The best solution to the doublet problem is experimental - that is, to avoid generating them in the first place. This should be a consideration when designing scRNA-seq experiments, where the desire to obtain large numbers of cells at minimum cost should be weighed against the general deterioration in data quality and reliability when doublets become more frequent. If cell labelling information is available (Kang et al. 2018; Stoeckius et al. 2018), we recommend using it to mark doublet cells for use in identification of problematic clusters or cellular states in downstream analyses. Direct removal fails to account for unlabelled intra-sample doublets that can still be present in sufficient numbers to drive misleading conclusions, while the marking approach uses “guilt by association” to identify neighboring unlabelled doublets.

Session Info

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS:   /home/ramezqui/Rbuild/danbuild/R-3.6.1/lib/libRblas.so
LAPACK: /home/ramezqui/Rbuild/danbuild/R-3.6.1/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] BiocSingular_1.2.0          scater_1.14.0              
 [3] ggplot2_3.2.1               scran_1.14.0               
 [5] SingleCellExperiment_1.8.0  SummarizedExperiment_1.16.0
 [7] DelayedArray_0.12.0         BiocParallel_1.20.0        
 [9] matrixStats_0.55.0          Biobase_2.46.0             
[11] GenomicRanges_1.38.0        GenomeInfoDb_1.22.0        
[13] IRanges_2.20.0              S4Vectors_0.24.0           
[15] BiocGenerics_0.32.0         Cairo_1.5-10               
[17] BiocStyle_2.14.0            OSCAUtils_0.0.1            

loaded via a namespace (and not attached):
 [1] viridis_0.5.1            edgeR_3.28.0            
 [3] viridisLite_0.3.0        DelayedMatrixStats_1.8.0
 [5] assertthat_0.2.1         statmod_1.4.32          
 [7] highr_0.8                BiocManager_1.30.9      
 [9] dqrng_0.2.1              GenomeInfoDbData_1.2.2  
[11] vipor_0.4.5              yaml_2.2.0              
[13] pillar_1.4.2             lattice_0.20-38         
[15] glue_1.3.1               limma_3.42.0            
[17] digest_0.6.22            RColorBrewer_1.1-2      
[19] XVector_0.26.0           colorspace_1.4-1        
[21] cowplot_1.0.0            htmltools_0.4.0         
[23] Matrix_1.2-17            pkgconfig_2.0.3         
[25] pheatmap_1.0.12          bookdown_0.14           
[27] zlibbioc_1.32.0          purrr_0.3.3             
[29] scales_1.0.0             tibble_2.1.3            
[31] withr_2.1.2              lazyeval_0.2.2          
[33] magrittr_1.5             crayon_1.3.4            
[35] evaluate_0.14            beeswarm_0.2.3          
[37] tools_3.6.1              stringr_1.4.0           
[39] munsell_0.5.0            locfit_1.5-9.1          
[41] irlba_2.3.3              compiler_3.6.1          
[43] rsvd_1.0.2               rlang_0.4.1             
[45] grid_3.6.1               RCurl_1.95-4.12         
[47] BiocNeighbors_1.4.0      igraph_1.2.4.1          
[49] labeling_0.3             bitops_1.0-6            
[51] rmarkdown_1.16           gtable_0.3.0            
[53] R6_2.4.0                 gridExtra_2.3           
[55] knitr_1.25               dplyr_0.8.3             
[57] stringi_1.4.3            ggbeeswarm_0.6.0        
[59] Rcpp_1.0.2               tidyselect_0.2.5        
[61] xfun_0.10               

Bibliography

Bach, K., S. Pensa, M. Grzelak, J. Hadfield, D. J. Adams, J. C. Marioni, and W. T. Khaled. 2017. “Differentiation dynamics of mammary epithelial cells revealed by single-cell RNA sequencing.” Nat Commun 8 (1):2128.

Dahlin, J. S., F. K. Hamey, B. Pijuan-Sala, M. Shepherd, W. W. Y. Lau, S. Nestorowa, C. Weinreb, et al. 2018. “A single-cell hematopoietic landscape resolves 8 lineage trajectories and defects in Kit mutant mice.” Blood 131 (21):e1–e11.

Kang, H. M., M. Subramaniam, S. Targ, M. Nguyen, L. Maliskova, E. McCarthy, E. Wan, et al. 2018. “Multiplexed droplet single-cell RNA-sequencing using natural genetic variation.” Nat. Biotechnol. 36 (1):89–94.

Stoeckius, M., S. Zheng, B. Houck-Loomis, S. Hao, B. Yeung, P. Smibert, and R. Satija. 2017. “Cell "Hashing" with Barcoded Antibodies Enables Multiplexing and Doublet Detection for Single Cell Genomics.” bioRxiv. Cold Spring Harbor Laboratory. https://doi.org/10.1101/237693.

Stoeckius, M., S. Zheng, B. Houck-Loomis, S. Hao, B. Z. Yeung, W. M. Mauck, P. Smibert, and R. Satija. 2018. “Cell Hashing with barcoded antibodies enables multiplexing and doublet detection for single cell genomics.” Genome Biol. 19 (1):224.

Zheng, G. X., J. M. Terry, P. Belgrader, P. Ryvkin, Z. W. Bent, R. Wilson, S. B. Ziraldo, et al. 2017. “Massively parallel digital transcriptional profiling of single cells.” Nat Commun 8 (January):14049.