Chapter 42 HCA human bone marrow (10X Genomics)

42.1 Introduction

Here, we use an example dataset from the Human Cell Atlas immune cell profiling project on bone marrow, which contains scRNA-seq data for 380,000 cells generated using the 10X Genomics technology. This is a fairly big dataset that represents a good use case for the techniques in Chapter 23.

42.3 Quality control

Cell calling was not performed (see here) so we will perform QC using all metrics and block on the donor of origin during outlier detection. We perform the calculation across multiple cores to speed things up.

Distribution of QC metrics in the HCA bone marrow dataset. Each point represents a cell and is colored according to whether it was discarded.

Figure 42.1: Distribution of QC metrics in the HCA bone marrow dataset. Each point represents a cell and is colored according to whether it was discarded.

Percentage of mitochondrial reads in each cell in the HCA bone marrow dataset compared to its total count. Each point represents a cell and is colored according to whether that cell was discarded.

Figure 42.2: Percentage of mitochondrial reads in each cell in the HCA bone marrow dataset compared to its total count. Each point represents a cell and is colored according to whether that cell was discarded.

42.4 Normalization

For a minor speed-up, we use already-computed library sizes rather than re-computing them from the column sums.

##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.05    0.47    0.65    1.00    0.89   42.38

42.5 Variance modeling

We block on the donor of origin to mitigate batch effects during HVG selection. We select a larger number of HVGs to capture any batch-specific variation that might be present.

Per-gene variance as a function of the mean for the log-expression values in the HCA bone marrow dataset. Each point represents a gene (black) with the mean-variance trend (blue) fitted to the variances.

Figure 42.3: Per-gene variance as a function of the mean for the log-expression values in the HCA bone marrow dataset. Each point represents a gene (black) with the mean-variance trend (blue) fitted to the variances.

42.6 Data integration

Here we use multiple cores, randomized SVD and approximate nearest-neighbor detection to speed up this step.

We use the percentage of variance lost as a diagnostic measure:

##      MantonBM1 MantonBM2 MantonBM3 MantonBM4 MantonBM5 MantonBM6 MantonBM7
## [1,]  0.006925  0.006387  0.000000  0.000000  0.000000  0.000000  0.000000
## [2,]  0.006376  0.006853  0.023099  0.000000  0.000000  0.000000  0.000000
## [3,]  0.005068  0.003070  0.005132  0.019471  0.000000  0.000000  0.000000
## [4,]  0.002006  0.001873  0.001898  0.001780  0.023112  0.000000  0.000000
## [5,]  0.002445  0.002009  0.001780  0.002923  0.002634  0.023804  0.000000
## [6,]  0.003106  0.003178  0.003068  0.002581  0.003283  0.003363  0.024562
## [7,]  0.001939  0.001677  0.002427  0.002013  0.001555  0.002270  0.001969
##      MantonBM8
## [1,]   0.00000
## [2,]   0.00000
## [3,]   0.00000
## [4,]   0.00000
## [5,]   0.00000
## [6,]   0.00000
## [7,]   0.03213

42.7 Dimensionality reduction

We set external_neighbors=TRUE to replace the internal nearest neighbor search in the UMAP implementation with our parallelized approximate search. We also set the number of threads to be used in the UMAP iterations.

42.8 Clustering

Graph-based clustering generates an excessively large intermediate graph so we will instead use a two-step approach with \(k\)-means. We generate 1000 small clusters that are subsequently aggregated into more interpretable groups with a graph-based method. If more resolution is required, we can increase centers in addition to using a lower k during graph construction.

## 
##     1     2     3     4     5     6     7     8     9    10    11    12    13 
## 65896 47244 30659 37110  7039 10193 18585 17064 26262  8870  7993  7968  3732 
##    14    15    16    17    18    19 
##  3685  4993 11048  3161  3024  2199

We observe mostly balanced contributions from different samples to each cluster (Figure 42.4), consistent with the expectation that all samples are replicates from different donors.

Heatmap of log~10~-number of cells in each cluster (row) from each sample (column).

Figure 42.4: Heatmap of log10-number of cells in each cluster (row) from each sample (column).

UMAP plots of the HCA bone marrow dataset after merging. Each point represents a cell and is colored according to the assigned cluster (top) or the donor of origin (bottom).

Figure 42.5: UMAP plots of the HCA bone marrow dataset after merging. Each point represents a cell and is colored according to the assigned cluster (top) or the donor of origin (bottom).

42.9 Differential expression

We identify marker genes for each cluster while blocking on the donor.

We visualize the top markers for a randomly chosen cluster using a “dot plot” in Figure 42.6. The presence of upregulated genes like LYZ, S100A8 and VCAN is consistent with a monocyte identity for this cluster.

Heatmap of log~2~-fold changes for the top marker genes (rows) of cluster 2 compared to all other clusters (columns).

Figure 42.6: Heatmap of log2-fold changes for the top marker genes (rows) of cluster 2 compared to all other clusters (columns).

42.10 Cell type classification

We perform automated cell type classification using a reference dataset to annotate each cluster based on its pseudo-bulk profile. This is faster than the per-cell approaches described in Chapter 12 at the cost of the resolution required to detect heterogeneity inside a cluster. Nonetheless, it is often sufficient for a quick assignment of cluster identity, and indeed, cluster 2 is also identified as consisting of monocytes from this analysis.

## DataFrame with 19 rows and 5 columns
##                             scores     first.labels      tuning.scores
##                           <matrix>      <character>        <DataFrame>
## 1   0.325925:0.652679:0.575563:...          T_cells 0.691160:0.1929391
## 2   0.296605:0.741579:0.529038:... Pre-B_cell_CD34- 0.565504:0.2473908
## 3   0.311871:0.672003:0.539219:...           B_cell 0.621882:0.0147466
## 4   0.335035:0.658920:0.580926:...          T_cells 0.643977:0.3972014
## 5   0.333016:0.614727:0.522212:...          T_cells 0.603456:0.4050120
## ...                            ...              ...                ...
## 15  0.380959:0.683493:0.784153:...              MEP  0.376779:0.374257
## 16  0.309959:0.666660:0.548568:...           B_cell  0.775892:0.716429
## 17  0.367825:0.654503:0.580287:...           B_cell  0.530394:0.327330
## 18  0.409967:0.708583:0.643723:... Pro-B_cell_CD34+  0.851223:0.780534
## 19  0.331292:0.671789:0.555484:... Pre-B_cell_CD34-  0.139321:0.121342
##               labels    pruned.labels
##          <character>      <character>
## 1            T_cells          T_cells
## 2           Monocyte         Monocyte
## 3             B_cell           B_cell
## 4            T_cells          T_cells
## 5            T_cells          T_cells
## ...              ...              ...
## 15        BM & Prog.       BM & Prog.
## 16            B_cell           B_cell
## 17            B_cell               NA
## 18  Pro-B_cell_CD34+ Pro-B_cell_CD34+
## 19               GMP              GMP

Session Info

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS

Matrix products: default
BLAS:   /home/biocbuild/bbs-3.12-bioc/R/lib/libRblas.so
LAPACK: /home/biocbuild/bbs-3.12-bioc/R/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] SingleR_1.4.0               celldex_1.0.0              
 [3] pheatmap_1.0.12             bluster_1.0.0              
 [5] BiocNeighbors_1.8.0         batchelor_1.6.0            
 [7] scran_1.18.0                BiocParallel_1.24.0        
 [9] scater_1.18.0               ggplot2_3.3.2              
[11] EnsDb.Hsapiens.v86_2.99.0   ensembldb_2.14.0           
[13] AnnotationFilter_1.14.0     GenomicFeatures_1.42.0     
[15] AnnotationDbi_1.52.0        rhdf5_2.34.0               
[17] HCAData_1.6.0               SingleCellExperiment_1.12.0
[19] SummarizedExperiment_1.20.0 Biobase_2.50.0             
[21] GenomicRanges_1.42.0        GenomeInfoDb_1.26.0        
[23] IRanges_2.24.0              S4Vectors_0.28.0           
[25] BiocGenerics_0.36.0         MatrixGenerics_1.2.0       
[27] matrixStats_0.57.0          BiocStyle_2.18.0           
[29] rebook_1.0.0               

loaded via a namespace (and not attached):
  [1] AnnotationHub_2.22.0          BiocFileCache_1.14.0         
  [3] igraph_1.2.6                  lazyeval_0.2.2               
  [5] digest_0.6.27                 htmltools_0.5.0              
  [7] viridis_0.5.1                 magrittr_1.5                 
  [9] memoise_1.1.0                 limma_3.46.0                 
 [11] Biostrings_2.58.0             askpass_1.1                  
 [13] prettyunits_1.1.1             colorspace_1.4-1             
 [15] blob_1.2.1                    rappdirs_0.3.1               
 [17] xfun_0.19                     dplyr_1.0.2                  
 [19] callr_3.5.1                   crayon_1.3.4                 
 [21] RCurl_1.98-1.2                graph_1.68.0                 
 [23] glue_1.4.2                    gtable_0.3.0                 
 [25] zlibbioc_1.36.0               XVector_0.30.0               
 [27] DelayedArray_0.16.0           BiocSingular_1.6.0           
 [29] Rhdf5lib_1.12.0               HDF5Array_1.18.0             
 [31] scales_1.1.1                  DBI_1.1.0                    
 [33] edgeR_3.32.0                  Rcpp_1.0.5                   
 [35] viridisLite_0.3.0             xtable_1.8-4                 
 [37] progress_1.2.2                dqrng_0.2.1                  
 [39] bit_4.0.4                     rsvd_1.0.3                   
 [41] ResidualMatrix_1.0.0          httr_1.4.2                   
 [43] RColorBrewer_1.1-2            ellipsis_0.3.1               
 [45] pkgconfig_2.0.3               XML_3.99-0.5                 
 [47] farver_2.0.3                  scuttle_1.0.0                
 [49] uwot_0.1.8                    CodeDepends_0.6.5            
 [51] dbplyr_1.4.4                  locfit_1.5-9.4               
 [53] tidyselect_1.1.0              labeling_0.4.2               
 [55] rlang_0.4.8                   later_1.1.0.1                
 [57] munsell_0.5.0                 BiocVersion_3.12.0           
 [59] tools_4.0.3                   generics_0.1.0               
 [61] RSQLite_2.2.1                 ExperimentHub_1.16.0         
 [63] evaluate_0.14                 stringr_1.4.0                
 [65] fastmap_1.0.1                 yaml_2.2.1                   
 [67] processx_3.4.4                knitr_1.30                   
 [69] bit64_4.0.5                   purrr_0.3.4                  
 [71] sparseMatrixStats_1.2.0       mime_0.9                     
 [73] xml2_1.3.2                    biomaRt_2.46.0               
 [75] compiler_4.0.3                beeswarm_0.2.3               
 [77] curl_4.3                      interactiveDisplayBase_1.28.0
 [79] tibble_3.0.4                  statmod_1.4.35               
 [81] stringi_1.5.3                 highr_0.8                    
 [83] ps_1.4.0                      RSpectra_0.16-0              
 [85] lattice_0.20-41               ProtGenerics_1.22.0          
 [87] Matrix_1.2-18                 vctrs_0.3.4                  
 [89] pillar_1.4.6                  lifecycle_0.2.0              
 [91] rhdf5filters_1.2.0            BiocManager_1.30.10          
 [93] cowplot_1.1.0                 bitops_1.0-6                 
 [95] irlba_2.3.3                   httpuv_1.5.4                 
 [97] rtracklayer_1.50.0            R6_2.5.0                     
 [99] bookdown_0.21                 promises_1.1.1               
[101] gridExtra_2.3                 vipor_0.4.5                  
[103] codetools_0.2-16              assertthat_0.2.1             
[105] openssl_1.4.3                 withr_2.3.0                  
[107] GenomicAlignments_1.26.0      Rsamtools_2.6.0              
[109] GenomeInfoDbData_1.2.4        hms_0.5.3                    
[111] grid_4.0.3                    beachmat_2.6.0               
[113] rmarkdown_2.5                 DelayedMatrixStats_1.12.0    
[115] shiny_1.5.0                   ggbeeswarm_0.6.0