Chapter 8 Cross-annotating human pancreas
8.1 Loading the data
We load the Muraro et al. (2016) dataset as our reference, removing unlabelled cells or cells without a clear label.
library(scRNAseq)
sceM <- MuraroPancreasData()
sceM <- sceM[,!is.na(sceM$label) & sceM$label!="unclear"]
We compute log-expression values for use in marker detection inside SingleR()
.
We examine the distribution of labels in this reference.
##
## acinar alpha beta delta duct endothelial
## 219 812 448 193 245 21
## epsilon mesenchymal pp
## 3 80 101
We load the Grun et al. (2016) dataset as our test, applying some basic quality control to remove low-quality cells in some of the batches (see here for details).
sceG <- GrunPancreasData()
sceG <- addPerCellQC(sceG)
qc <- quickPerCellQC(colData(sceG),
percent_subsets="altexps_ERCC_percent",
batch=sceG$donor,
subset=sceG$donor %in% c("D17", "D7", "D2"))
sceG <- sceG[,!qc$discard]
Technically speaking, the test dataset does not need log-expression values but we compute them anyway for convenience.
8.2 Applying the annotation
We apply SingleR()
with Wilcoxon rank sum test-based marker detection to annotate the Grun dataset with the Muraro labels.
We examine the distribution of predicted labels:
##
## acinar alpha beta delta duct endothelial
## 277 203 181 50 306 5
## epsilon mesenchymal pp
## 1 22 19
We can also examine the number of discarded cells for each label:
## Lost
## Label FALSE TRUE
## acinar 251 26
## alpha 198 5
## beta 180 1
## delta 49 1
## duct 301 5
## endothelial 4 1
## epsilon 1 0
## mesenchymal 22 0
## pp 17 2
8.3 Diagnostics
We visualize the assignment scores for each label in Figure 8.1.
The delta for each cell is visualized in Figure 8.2.
Finally, we visualize the heatmaps of the marker genes for each label in Figure 8.3.
library(scater)
collected <- list()
all.markers <- metadata(pred.grun)$de.genes
sceG$labels <- pred.grun$labels
for (lab in unique(pred.grun$labels)) {
collected[[lab]] <- plotHeatmap(sceG, silent=TRUE,
order_columns_by="labels", main=lab,
features=unique(unlist(all.markers[[lab]])))[[4]]
}
do.call(gridExtra::grid.arrange, collected)
8.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
(increasing the resolution by dropping k=5
).
library(scran)
decG <- modelGeneVarWithSpikes(sceG, "ERCC")
set.seed(1000100)
sceG <- denoisePCA(sceG, decG)
library(bluster)
sceG$cluster <- clusterRows(reducedDim(sceG), NNGraphParam(k=5))
We see that the clusters map reasonably well to the labels in Figure 8.4.
We proceed to the most important part of the analysis. Yes, that’s right, the \(t\)-SNE plot (Figure 8.5).
set.seed(101010100)
sceG <- runTSNE(sceG, dimred="PCA")
plotTSNE(sceG, colour_by="cluster", text_colour="red",
text_by=I(pred.grun$labels))
Session information
R version 4.2.0 RC (2022-04-19 r82224)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB 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] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] bluster_1.6.0 scran_1.24.0
[3] SingleR_1.10.0 scater_1.24.0
[5] ggplot2_3.3.5 scuttle_1.6.0
[7] scRNAseq_2.9.2 SingleCellExperiment_1.18.0
[9] SummarizedExperiment_1.26.0 Biobase_2.56.0
[11] GenomicRanges_1.48.0 GenomeInfoDb_1.32.0
[13] IRanges_2.30.0 S4Vectors_0.34.0
[15] BiocGenerics_0.42.0 MatrixGenerics_1.8.0
[17] matrixStats_0.62.0 BiocStyle_2.24.0
[19] rebook_1.6.0
loaded via a namespace (and not attached):
[1] AnnotationHub_3.4.0 BiocFileCache_2.4.0
[3] igraph_1.3.1 lazyeval_0.2.2
[5] BiocParallel_1.30.0 digest_0.6.29
[7] ensembldb_2.20.0 htmltools_0.5.2
[9] viridis_0.6.2 fansi_1.0.3
[11] magrittr_2.0.3 memoise_2.0.1
[13] ScaledMatrix_1.4.0 cluster_2.1.3
[15] limma_3.52.0 Biostrings_2.64.0
[17] prettyunits_1.1.1 colorspace_2.0-3
[19] blob_1.2.3 rappdirs_0.3.3
[21] ggrepel_0.9.1 xfun_0.30
[23] dplyr_1.0.8 crayon_1.5.1
[25] RCurl_1.98-1.6 jsonlite_1.8.0
[27] graph_1.74.0 glue_1.6.2
[29] gtable_0.3.0 zlibbioc_1.42.0
[31] XVector_0.36.0 DelayedArray_0.22.0
[33] BiocSingular_1.12.0 scales_1.2.0
[35] pheatmap_1.0.12 edgeR_3.38.0
[37] DBI_1.1.2 Rcpp_1.0.8.3
[39] viridisLite_0.4.0 xtable_1.8-4
[41] progress_1.2.2 dqrng_0.3.0
[43] bit_4.0.4 rsvd_1.0.5
[45] metapod_1.4.0 httr_1.4.2
[47] RColorBrewer_1.1-3 dir.expiry_1.4.0
[49] ellipsis_0.3.2 farver_2.1.0
[51] pkgconfig_2.0.3 XML_3.99-0.9
[53] CodeDepends_0.6.5 sass_0.4.1
[55] dbplyr_2.1.1 locfit_1.5-9.5
[57] utf8_1.2.2 labeling_0.4.2
[59] tidyselect_1.1.2 rlang_1.0.2
[61] later_1.3.0 AnnotationDbi_1.58.0
[63] munsell_0.5.0 BiocVersion_3.15.2
[65] tools_4.2.0 cachem_1.0.6
[67] cli_3.3.0 generics_0.1.2
[69] RSQLite_2.2.12 ExperimentHub_2.4.0
[71] evaluate_0.15 stringr_1.4.0
[73] fastmap_1.1.0 yaml_2.3.5
[75] knitr_1.38 bit64_4.0.5
[77] purrr_0.3.4 KEGGREST_1.36.0
[79] AnnotationFilter_1.20.0 sparseMatrixStats_1.8.0
[81] mime_0.12 xml2_1.3.3
[83] biomaRt_2.52.0 compiler_4.2.0
[85] beeswarm_0.4.0 filelock_1.0.2
[87] curl_4.3.2 png_0.1-7
[89] interactiveDisplayBase_1.34.0 statmod_1.4.36
[91] tibble_3.1.6 bslib_0.3.1
[93] stringi_1.7.6 highr_0.9
[95] GenomicFeatures_1.48.0 lattice_0.20-45
[97] ProtGenerics_1.28.0 Matrix_1.4-1
[99] vctrs_0.4.1 pillar_1.7.0
[101] lifecycle_1.0.1 BiocManager_1.30.17
[103] jquerylib_0.1.4 BiocNeighbors_1.14.0
[105] cowplot_1.1.1 bitops_1.0-7
[107] irlba_2.3.5 httpuv_1.6.5
[109] rtracklayer_1.56.0 R6_2.5.1
[111] BiocIO_1.6.0 bookdown_0.26
[113] promises_1.2.0.1 gridExtra_2.3
[115] vipor_0.4.5 codetools_0.2-18
[117] assertthat_0.2.1 rjson_0.2.21
[119] withr_2.5.0 GenomicAlignments_1.32.0
[121] Rsamtools_2.12.0 GenomeInfoDbData_1.2.8
[123] parallel_4.2.0 hms_1.1.1
[125] grid_4.2.0 beachmat_2.12.0
[127] rmarkdown_2.14 DelayedMatrixStats_1.18.0
[129] Rtsne_0.16 shiny_1.7.1
[131] ggbeeswarm_0.6.0 restfulr_0.0.13
Bibliography
Grun, D., M. J. Muraro, J. C. Boisset, K. Wiebrands, A. Lyubimova, G. Dharmadhikari, M. van den Born, et al. 2016. “De Novo Prediction of Stem Cell Identity using Single-Cell Transcriptome Data.” Cell Stem Cell 19 (2): 266–77.
Muraro, M. J., G. Dharmadhikari, D. Grun, N. Groen, T. Dielen, E. Jansen, L. van Gurp, et al. 2016. “A Single-Cell Transcriptome Atlas of the Human Pancreas.” Cell Syst 3 (4): 385–94.