Chapter 9 Cross-annotating mouse brains

9.1 Loading the data

We load the classic Zeisel et al. (2015) dataset as our reference. Here, we’ll rely on the fact that the authors have already performed quality control.

We compute log-expression values for use in marker detection inside SingleR().

We examine the distribution of labels in this reference.

## 
##    (none)    Astro1    Astro2   CA1Pyr1   CA1Pyr2 CA1PyrInt   CA2Pyr2   Choroid 
##       189        68        61       380       447        49        41        10 
##   ClauPyr     Epend      Int1     Int10     Int11     Int12     Int13     Int14 
##         5        20        12        21        10        21        15        22 
##     Int15     Int16      Int2      Int3      Int4      Int5      Int6      Int7 
##        18        20        24        10        15        20        22        23 
##      Int8      Int9      Mgl1      Mgl2    Oligo1    Oligo2    Oligo3    Oligo4 
##        26        11        17        16        45        98        87       106 
##    Oligo5    Oligo6     Peric      Pvm1      Pvm2   S1PyrDL  S1PyrL23   S1PyrL4 
##       125       359        21        32        33        81        74        26 
##   S1PyrL5  S1PyrL5a   S1PyrL6  S1PyrL6b    SubPyr     Vend1     Vend2      Vsmc 
##        16        28        39        21        22        32       105        62

We load the Tasic et al. (2016) dataset as our test. While not strictly necessary, we remove putative low-quality cells to simplify later interpretation.

The Tasic dataset was generated using read-based technologies so we need to adjust for the transcript length.

9.2 Applying the annotation

We apply SingleR() with Wilcoxon rank sum test-based marker detection to annotate the Tasic dataset with the Zeisel labels.

We examine the distribution of predicted labels:

## 
##   Astro1   Astro2  CA1Pyr2  CA2Pyr2  ClauPyr     Int1    Int10    Int11 
##        1        5        1        3        1      152       98        2 
##    Int12    Int13    Int14    Int15    Int16     Int2     Int3     Int4 
##        9       18       24       16       10      146       94       29 
##     Int6     Int7     Int8     Int9   Oligo1   Oligo2   Oligo3   Oligo4 
##       14        2       35       31        8        1        7        1 
##   Oligo6    Peric  S1PyrDL S1PyrL23  S1PyrL4  S1PyrL5 S1PyrL5a  S1PyrL6 
##        1        1      319       73       16        4      201       46 
## S1PyrL6b   SubPyr 
##       73        5

We can also examine the number of discarded cells for each label:

##           Lost
## Label      FALSE TRUE
##   Astro1       1    0
##   Astro2       5    0
##   CA1Pyr2      1    0
##   CA2Pyr2      3    0
##   ClauPyr      1    0
##   Int1       152    0
##   Int10       98    0
##   Int11        2    0
##   Int12        9    0
##   Int13       18    0
##   Int14       23    1
##   Int15       16    0
##   Int16       10    0
##   Int2       144    2
##   Int3        94    0
##   Int4        29    0
##   Int6        14    0
##   Int7         2    0
##   Int8        35    0
##   Int9        31    0
##   Oligo1       8    0
##   Oligo2       1    0
##   Oligo3       7    0
##   Oligo4       1    0
##   Oligo6       1    0
##   Peric        1    0
##   S1PyrDL    303   16
##   S1PyrL23    73    0
##   S1PyrL4     16    0
##   S1PyrL5      4    0
##   S1PyrL5a   200    1
##   S1PyrL6     45    1
##   S1PyrL6b    72    1
##   SubPyr       5    0

9.3 Diagnostics

We visualize the assignment scores for each label in Figure 9.1.

Heatmap of the (normalized) assignment scores for each cell (column) in the Tasic test dataset with respect to each label (row) in the Zeisel reference dataset. The final assignment for each cell is shown in the annotation bar at the top.

Figure 9.1: Heatmap of the (normalized) assignment scores for each cell (column) in the Tasic test dataset with respect to each label (row) in the Zeisel reference dataset. The final assignment for each cell is shown in the annotation bar at the top.

The delta for each cell is visualized in Figure 9.2.

Distributions of the deltas for each cell in the Tasic dataset assigned to each label in the Zeisel dataset. Each cell is represented by a point; low-quality assignments that were pruned out are colored in orange.

Figure 9.2: Distributions of the deltas for each cell in the Tasic dataset assigned to each label in the Zeisel dataset. Each cell is represented by a point; low-quality assignments that were pruned out are colored in orange.

Finally, we visualize the heatmaps of the marker genes for the most frequent label in Figure 9.3. We could show these for all labels but I wouldn’t want to bore you with a parade of large heatmaps.

Heatmap of log-expression values in the Tasic dataset for all marker genes upregulated in the most frequent label from the Zeisel reference dataset.

Figure 9.3: Heatmap of log-expression values in the Tasic dataset for all marker genes upregulated in the most frequent label from the Zeisel reference dataset.

9.4 Comparison to clusters

For comparison, we will perform a quick unsupervised analysis of the Grun dataset. We model the variances using the spike-in data and we perform graph-based clustering.

We do not observe a clean 1:1 mapping between clusters and labels in Figure 9.4, probably because many of the labels represent closely related cell types that are difficult to distinguish.

Heatmap of the log-transformed number of cells in each combination of label (column) and cluster (row) in the Tasic dataset.

Figure 9.4: Heatmap of the log-transformed number of cells in each combination of label (column) and cluster (row) in the Tasic dataset.

We proceed to the most important part of the analysis. Yes, that’s right, the \(t\)-SNE plot (Figure 9.5).

$t$-SNE plot of the Tasic dataset, where each point is a cell and is colored by the assigned cluster. Reference labels from the Zeisel dataset are also placed on the median coordinate across all cells assigned with that label.

Figure 9.5: \(t\)-SNE plot of the Tasic dataset, where each point is a cell and is colored by the assigned cluster. Reference labels from the Zeisel dataset are also placed on the median coordinate across all cells assigned with that label.

Session information

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] scran_1.18.0                SingleR_1.4.0              
 [3] ensembldb_2.14.0            AnnotationFilter_1.14.0    
 [5] GenomicFeatures_1.42.0      AnnotationDbi_1.52.0       
 [7] AnnotationHub_2.22.0        BiocFileCache_1.14.0       
 [9] dbplyr_1.4.4                scater_1.18.0              
[11] ggplot2_3.3.2               scRNAseq_2.4.0             
[13] SingleCellExperiment_1.12.0 SummarizedExperiment_1.20.0
[15] Biobase_2.50.0              GenomicRanges_1.42.0       
[17] GenomeInfoDb_1.26.0         IRanges_2.24.0             
[19] S4Vectors_0.28.0            BiocGenerics_0.36.0        
[21] MatrixGenerics_1.2.0        matrixStats_0.57.0         
[23] BiocStyle_2.18.0            rebook_1.0.0               

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

Bibliography

Tasic, B., V. Menon, T. N. Nguyen, T. K. Kim, T. Jarsky, Z. Yao, B. Levi, et al. 2016. “Adult mouse cortical cell taxonomy revealed by single cell transcriptomics.” Nat. Neurosci. 19 (2): 335–46.

Zeisel, A., A. B. Munoz-Manchado, S. Codeluppi, P. Lonnerberg, G. La Manno, A. Jureus, S. Marques, et al. 2015. “Brain structure. Cell types in the mouse cortex and hippocampus revealed by single-cell RNA-seq.” Science 347 (6226): 1138–42.