Chapter 9 Mouse HSC (multiple technologies)

9.1 Introduction

The blood is probably the most well-studied tissue in the single-cell field, mostly because everything is already dissociated “for free”. Of particular interest has been the use of single-cell genomics to study cell fate decisions in haematopoeisis. Indeed, it was not long ago that dueling interpretations of haematopoeitic stem cell (HSC) datasets were a mainstay of single-cell conferences. Sadly, these times have mostly passed so we will instead entertain ourselves by combining a small number of these datasets into a single analysis.

9.2 Data loading

#--- data-loading ---#
sce.nest <- NestorowaHSCData()

#--- gene-annotation ---#
library(AnnotationHub) <- AnnotationHub()[["AH73905"]]
anno <- select(, keys=rownames(sce.nest), 
    keytype="GENEID", columns=c("SYMBOL", "SEQNAME"))
rowData(sce.nest) <- anno[match(rownames(sce.nest), anno$GENEID),]

#--- quality-control ---#
stats <- perCellQCMetrics(sce.nest)
qc <- quickPerCellQC(stats, percent_subsets="altexps_ERCC_percent")
sce.nest <- sce.nest[,!qc$discard]

#--- normalization ---#
clusters <- quickCluster(sce.nest)
sce.nest <- computeSumFactors(sce.nest, clusters=clusters)
sce.nest <- logNormCounts(sce.nest)

#--- variance-modelling ---#
dec.nest <- modelGeneVarWithSpikes(sce.nest, "ERCC")
top.nest <- getTopHVGs(dec.nest, prop=0.1)
## class: SingleCellExperiment 
## dim: 46078 1656 
## metadata(0):
## assays(2): counts logcounts
## rownames(46078): ENSMUSG00000000001 ENSMUSG00000000003 ...
##   ENSMUSG00000107391 ENSMUSG00000107392
## rowData names(3): GENEID SYMBOL SEQNAME
## colnames(1656): HSPC_025 HSPC_031 ... Prog_852 Prog_810
## colData names(3): cell.type FACS sizeFactor
## reducedDimNames(1): diffusion
## mainExpName: endogenous
## altExpNames(1): ERCC

The Grun dataset requires a little bit of subsetting and re-analysis to only consider the sorted HSCs.

#--- data-loading ---#
sce.grun.hsc <- GrunHSCData(ensembl=TRUE)

#--- gene-annotation ---#
library(AnnotationHub) <- AnnotationHub()[["AH73905"]]
anno <- select(, keys=rownames(sce.grun.hsc), 
    keytype="GENEID", columns=c("SYMBOL", "SEQNAME"))
rowData(sce.grun.hsc) <- anno[match(rownames(sce.grun.hsc), anno$GENEID),]

#--- quality-control ---#
stats <- perCellQCMetrics(sce.grun.hsc)
qc <- quickPerCellQC(stats, batch=sce.grun.hsc$protocol,
    subset=grepl("sorted", sce.grun.hsc$protocol))
sce.grun.hsc <- sce.grun.hsc[,!qc$discard]
sce.grun.hsc <- sce.grun.hsc[,sce.grun.hsc$protocol=="sorted hematopoietic stem cells"]
sce.grun.hsc <- logNormCounts(sce.grun.hsc)

dec.grun.hsc <- modelGeneVarByPoisson(sce.grun.hsc) 

Finally, we will grab the Paul dataset, which we will also subset to only consider the unsorted myeloid population. This removes the various knockout conditions that just complicates matters.

#--- data-loading ---#
sce.paul <- PaulHSCData(ensembl=TRUE)

#--- gene-annotation ---#
library(AnnotationHub) <- AnnotationHub()[["AH73905"]]
anno <- select(, keys=rownames(sce.paul), 
    keytype="GENEID", columns=c("SYMBOL", "SEQNAME"))
rowData(sce.paul) <- anno[match(rownames(sce.paul), anno$GENEID),]

#--- quality-control ---#
stats <- perCellQCMetrics(sce.paul) 
qc <- quickPerCellQC(stats, batch=sce.paul$Plate_ID)

# Detecting batches with unusually low threshold values.
lib.thresholds <- attr(qc$low_lib_size, "thresholds")["lower",]
nfeat.thresholds <- attr(qc$low_n_features, "thresholds")["lower",]
ignore <- union(names(lib.thresholds)[lib.thresholds < 100],
    names(nfeat.thresholds)[nfeat.thresholds < 100])

# Repeating the QC using only the "high-quality" batches.
qc2 <- quickPerCellQC(stats, batch=sce.paul$Plate_ID,
    subset=!sce.paul$Plate_ID %in% ignore)
sce.paul <- sce.paul[,!qc2$discard]
sce.paul <- sce.paul[,sce.paul$Batch_desc=="Unsorted myeloid"]
sce.paul <- logNormCounts(sce.paul)

dec.paul <- modelGeneVarByPoisson(sce.paul) 

9.3 Setting up the merge

common <- Reduce(intersect, list(rownames(sce.nest),
    rownames(sce.grun.hsc), rownames(sce.paul)))
## [1] 17147

Combining variances to obtain a single set of HVGs.

combined.dec <- combineVar(
hvgs <- getTopHVGs(combined.dec, n=5000)

Adjusting for gross differences in sequencing depth.

normed.sce <- multiBatchNorm(

9.4 Merging the datasets

We turn on auto.merge=TRUE to instruct fastMNN() to merge the batch that offers the largest number of MNNs. This aims to perform the “easiest” merges first, i.e., between the most replicate-like batches, before tackling merges between batches that have greater differences in their population composition.

merged <- fastMNN(normed.sce, subset.row=hvgs, auto.merge=TRUE)

Not too much variance lost inside each batch, hopefully. We also observe that the algorithm chose to merge the more diverse Nestorowa and Paul datasets before dealing with the HSC-only Grun dataset.

metadata(merged)$[,c("left", "right", "lost.var")]
## DataFrame with 2 rows and 3 columns
##             left     right                        lost.var
##           <List>    <List>                        <matrix>
## 1           Paul Nestorowa 0.01069374:0.0000000:0.00739465
## 2 Paul,Nestorowa      Grun 0.00562344:0.0178334:0.00702615

9.5 Combined analyses

The Grun dataset does not contribute to many clusters, consistent with a pure undifferentiated HSC population. Most of the other clusters contain contributions from the Nestorowa and Paul datasets, though some are unique to the Paul dataset. This may be due to incomplete correction though we tend to think that this are Paul-specific subpopulations, given that the Nestorowa dataset does not have similarly sized unique clusters that might represent their uncorrected counterparts.

colLabels(merged) <- clusterRows(reducedDim(merged), 
table(Cluster=colLabels(merged), Batch=merged$batch)
##        Batch
## Cluster Grun Nestorowa Paul
##      1    32       472  109
##      2    91       227   16
##      3    42       297  104
##      4     0        40  564
##      5     0       175  569
##      6     0       216  513
##      7   126        69  343
##      8     0         6   29
##      9     0       135  176
##      10    0        19    0
##      11    0         0  382

While I prefer \(t\)-SNE plots, we’ll switch to a UMAP plot to highlight some of the trajectory-like structure across clusters (Figure 9.1).

merged <- runUMAP(merged, dimred="corrected")
    plotUMAP(merged, colour_by="label"),
    plotUMAP(merged, colour_by="batch"),
Obligatory UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by the batch of origin (left) or its assigned cluster (right).

Figure 9.1: Obligatory UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by the batch of origin (left) or its assigned cluster (right).

In fact, we might as well compute a trajectory right now. TSCAN constructs a reasonable minimum spanning tree but the path choices are somewhat incongruent with the UMAP coordinates (Figure 9.2). This is most likely due to the fact that TSCAN operates on cluster centroids, which is simple and efficient but does not consider the variance of cells within each cluster. It is entirely possible for two well-separated clusters to be closer than two adjacent clusters if the latter span a wider region of the coordinate space.

pseudo.out <- quickPseudotime(merged, use.dimred="corrected", outgroup=TRUE)
common.pseudo <- averagePseudotime(pseudo.out$ordering)
plotUMAP(merged, colour_by=I(common.pseudo), 
        text_by="label", text_colour="red") +
        mapping=aes(x=UMAP1, y=UMAP2, group=edge))
Another UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by its _TSCAN_ pseudotime. The lines correspond to the edges of the MST across cluster centers.

Figure 9.2: Another UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by its TSCAN pseudotime. The lines correspond to the edges of the MST across cluster centers.

To fix this, we construct the minimum spanning tree using distances based on pairs of mutual nearest neighbors between clusters. This focuses on the closeness of the boundaries of each pair of clusters rather than their centroids, ensuring that adjacent clusters are connected even if their centroids are far apart. Doing so yields a trajectory that is more consistent with the visual connections on the UMAP plot (Figure 9.3).

pseudo.out2 <- quickPseudotime(merged, use.dimred="corrected", 
    dist.method="mnn", outgroup=TRUE)

common.pseudo2 <- averagePseudotime(pseudo.out2$ordering)
plotUMAP(merged, colour_by=I(common.pseudo2), 
        text_by="label", text_colour="red") +
        mapping=aes(x=UMAP1, y=UMAP2, group=edge))
Yet another UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by its _TSCAN_ pseudotime. The lines correspond to the edges of the MST across cluster centers.

Figure 9.3: Yet another UMAP plot of the merged HSC datasets, where each point represents a cell and is colored by its TSCAN pseudotime. The lines correspond to the edges of the MST across cluster centers.

Session Info

R version 4.3.0 RC (2023-04-13 r84269)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /home/biocbuild/bbs-3.17-bioc/R/lib/ 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB              LC_COLLATE=C              
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

time zone: America/New_York
tzcode source: system (glibc)

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

other attached packages:
 [1] TSCAN_1.38.0                TrajectoryUtils_1.8.0      
 [3] scater_1.28.0               ggplot2_3.4.2              
 [5] bluster_1.10.0              batchelor_1.16.0           
 [7] scran_1.28.1                scuttle_1.10.1             
 [9] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.1
[11] Biobase_2.60.0              GenomicRanges_1.52.0       
[13] GenomeInfoDb_1.36.0         IRanges_2.34.0             
[15] S4Vectors_0.38.1            BiocGenerics_0.46.0        
[17] MatrixGenerics_1.12.0       matrixStats_0.63.0         
[19] BiocStyle_2.28.0            rebook_1.10.0              

loaded via a namespace (and not attached):
  [1] bitops_1.0-7              gridExtra_2.3            
  [3] CodeDepends_0.6.5         rlang_1.1.1              
  [5] magrittr_2.0.3            RcppAnnoy_0.0.20         
  [7] compiler_4.3.0            mgcv_1.8-42              
  [9] dir.expiry_1.8.0          DelayedMatrixStats_1.22.0
 [11] vctrs_0.6.2               combinat_0.0-8           
 [13] pkgconfig_2.0.3           crayon_1.5.2             
 [15] fastmap_1.1.1             ellipsis_0.3.2           
 [17] XVector_0.40.0            labeling_0.4.2           
 [19] caTools_1.18.2            utf8_1.2.3               
 [21] promises_1.2.0.1          rmarkdown_2.21           
 [23] graph_1.78.0              ggbeeswarm_0.7.2         
 [25] xfun_0.39                 zlibbioc_1.46.0          
 [27] cachem_1.0.8              beachmat_2.16.0          
 [29] jsonlite_1.8.4            later_1.3.1              
 [31] highr_0.10                DelayedArray_0.26.2      
 [33] BiocParallel_1.34.1       irlba_2.3.5.1            
 [35] parallel_4.3.0            cluster_2.1.4            
 [37] R6_2.5.1                  bslib_0.4.2              
 [39] limma_3.56.1              jquerylib_0.1.4          
 [41] Rcpp_1.0.10               bookdown_0.34            
 [43] knitr_1.42                httpuv_1.6.11            
 [45] splines_4.3.0             Matrix_1.5-4             
 [47] igraph_1.4.2              tidyselect_1.2.0         
 [49] yaml_2.3.7                viridis_0.6.3            
 [51] gplots_3.1.3              codetools_0.2-19         
 [53] plyr_1.8.8                lattice_0.21-8           
 [55] tibble_3.2.1              shiny_1.7.4              
 [57] withr_2.5.0               evaluate_0.21            
 [59] mclust_6.0.0              pillar_1.9.0             
 [61] BiocManager_1.30.20       filelock_1.0.2           
 [63] KernSmooth_2.23-21        generics_0.1.3           
 [65] RCurl_1.98-1.12           fastICA_1.2-3            
 [67] sparseMatrixStats_1.12.0  munsell_0.5.0            
 [69] scales_1.2.1              xtable_1.8-4             
 [71] gtools_3.9.4              glue_1.6.2               
 [73] metapod_1.8.0             tools_4.3.0              
 [75] BiocNeighbors_1.18.0      ScaledMatrix_1.8.1       
 [77] locfit_1.5-9.7            XML_3.99-0.14            
 [79] cowplot_1.1.1             grid_4.3.0               
 [81] edgeR_3.42.2              colorspace_2.1-0         
 [83] nlme_3.1-162              GenomeInfoDbData_1.2.10  
 [85] beeswarm_0.4.0            BiocSingular_1.16.0      
 [87] vipor_0.4.5               cli_3.6.1                
 [89] rsvd_1.0.5                rappdirs_0.3.3           
 [91] fansi_1.0.4               S4Arrays_1.0.4           
 [93] viridisLite_0.4.2         dplyr_1.1.2              
 [95] uwot_0.1.14               ResidualMatrix_1.10.0    
 [97] gtable_0.3.3              sass_0.4.6               
 [99] digest_0.6.31             ggrepel_0.9.3            
[101] dqrng_0.3.0               farver_2.1.1             
[103] htmltools_0.5.5           lifecycle_1.0.3          
[105] mime_0.12                 statmod_1.5.0