To install the package, start R and enter:
if(!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("MerfishData")
After the installation, we proceed by loading the package and additional packages used in the vignette.
library(MerfishData)
library(ExperimentHub)
library(ggpubr)
Moffitt et al., 2018 developed an imaging-based cell type identification and mapping method and combined it with single-cell RNA-sequencing to create a molecularly annotated and spatially resolved cell atlas of the mouse hypothalamic preoptic region.
Def. hypothalamic preoptic region: is a part of the anterior hypothalamus that controls essential social behaviors and homeostatic functions.
Cell segmentation was carried out based on total polyadenylated mRNA and DAPI nuclei costains. Combinatorial smFISH imaging was used for the identification and spatial expression profiling of 161 genes in 1,027,848 cells from 36 mice (16 female, 20 male).
The data was obtained from the datadryad data publication.
This vignette demonstrates how to obtain the MERFISH mouse hypothalamic preoptic region dataset from Moffitt et al., 2018 from Bioconductor’s ExperimentHub.
eh <- ExperimentHub()
#> snapshotDate(): 2022-10-24
query(eh, c("MerfishData", "hypothalamus"))
#> ExperimentHub with 2 records
#> # snapshotDate(): 2022-10-24
#> # $dataprovider: Howard Hughes Medical Institute
#> # $species: Mus musculus
#> # $rdataclass: data.frame
#> # additional mcols(): taxonomyid, genome, description,
#> # coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
#> # rdatapath, sourceurl, sourcetype
#> # retrieve records with, e.g., 'object[["EH7546"]]'
#>
#> title
#> EH7546 | Mofitt2018_hypothalamus_segmentation
#> EH7553 | Mofitt2018_hypothalamus_molecules
Note: complementary scRNA-seq of ~31,000 cells dissociated and captured from the preoptic region of the hypothalamus from multiple male and female mice is available on GEO (GSE113576).
It is also possible to obtain the data in a SpatialExperiment, which integrates experimental data and cell metadata, and provides designated accessors for the spatial coordinates.
spe <- MouseHypothalamusMoffitt2018()
spe
#> class: SpatialExperiment
#> dim: 161 73655
#> metadata(0):
#> assays(1): exprs
#> rownames(161): Ace2 Adora2a ... Ucn3 Vgf
#> rowData names(0):
#> colnames: NULL
#> colData names(6): cell_id sample_id ... cell_class neuron_cluster_id
#> reducedDimNames(0):
#> mainExpName: NULL
#> altExpNames(0):
#> spatialCoords names(3) : x y z
#> imgData names(0):
Inspect the data components:
assay(spe)[1:5,1:5]
#> [,1] [,2] [,3] [,4] [,5]
#> Ace2 0.000000 0.0000000 0.000000 0.0000000 0.000000
#> Adora2a 1.638275 0.0000000 0.000000 0.0000000 0.000000
#> Aldh1l1 21.299750 1.5788733 2.701349 1.8451161 6.352415
#> Amigo2 0.000000 0.0000000 5.402654 0.9225604 0.000000
#> Ano3 1.638275 0.7894518 0.000000 0.0000000 0.000000
colData(spe)
#> DataFrame with 73655 rows and 6 columns
#> cell_id sample_id sex behavior cell_class
#> <character> <character> <character> <character> <character>
#> 1 6d6b1d59-6f3b-4a9d-b.. 1 Female Naive OD Mature 2
#> 2 76200644-c14a-4cfa-8.. 1 Female Naive OD Immature 1
#> 3 6b08ca36-b395-415a-b.. 1 Female Naive Inhibitory
#> 4 b9cb9cfb-fff7-426e-8.. 1 Female Naive Excitatory
#> 5 982cc0fc-6d11-4dc4-9.. 1 Female Naive OD Mature 2
#> ... ... ... ... ... ...
#> 73651 681fa623-a123-414a-8.. 1 Female Naive Astrocyte
#> 73652 9f98c288-8825-42b1-a.. 1 Female Naive Inhibitory
#> 73653 17ef8dff-989e-4565-b.. 1 Female Naive Endothelial 1
#> 73654 aef1c6c6-55ed-4a75-a.. 1 Female Naive Inhibitory
#> 73655 6613582b-b474-487b-b.. 1 Female Naive Endothelial 1
#> neuron_cluster_id
#> <character>
#> 1 NA
#> 2 NA
#> 3 I-7
#> 4 E-13
#> 5 NA
#> ... ...
#> 73651 NA
#> 73652 I-6
#> 73653 NA
#> 73654 I-1
#> 73655 NA
head(spatialCoords(spe))
#> x y z
#> [1,] -882.5464 -777.3718 -0.29
#> [2,] -839.9819 -744.3768 -0.29
#> [3,] -826.8182 -787.0326 -0.29
#> [4,] -830.1283 -737.4347 -0.29
#> [5,] -813.2421 -743.1137 -0.29
#> [6,] -808.9180 -761.4740 -0.29
Def. Bregma: The bregma is the anatomical point on the skull at which the coronal suture is intersected perpendicularly by the sagittal suture. Used here as a reference point for the twelve 1.8- by 1.8-mm imaged slices along the z-axis.
The anterior position of the preoptic region is at Bregma +0.26.
table(spatialCoords(spe)[,"z"])
#>
#> -0.29 -0.24 -0.19 -0.14 -0.09 -0.04 0.01 0.06 0.11 0.16 0.21 0.26
#> 6509 6412 6507 6605 6185 6154 6111 6144 5799 6067 5578 5584
Cell type assignment:
table(spe$cell_class)
#>
#> Ambiguous Astrocyte Endothelial 1 Endothelial 2 Endothelial 3
#> 9282 8393 3799 581 1369
#> Ependymal Excitatory Inhibitory Microglia OD Immature 1
#> 1961 11757 24761 1472 2457
#> OD Immature 2 OD Mature 1 OD Mature 2 OD Mature 3 OD Mature 4
#> 91 952 5736 39 367
#> Pericytes
#> 638
Visualize cell centroids and annotated cell type labels as in Figure 3E of the paper for six different anterior-posterior positions from a single female mouse.
relz <- c(0.26, 0.16, 0.06, -0.04, -0.14, -0.24)
cdat <- data.frame(colData(spe), spatialCoords(spe))
cdat <- subset(cdat, cell_class != "Ambiguous")
cdat$cell_class <- sub(" [1-4]$", "", cdat$cell_class)
cdat <- subset(cdat, z %in% relz)
cdat$z <- as.character(cdat$z)
zum <- paste(0:5 * 100, "um")
names(zum) <- as.character(relz)
cdat$z <- unname(zum[cdat$z])
pal <- get_palette("simpsons", 9)
names(pal) <- c("Endothelial", "Excitatory", "OD Immature", "Astrocyte", "Mural",
"Microglia", "Ependymal", "Inhibitory", "OD Mature")
ggscatter(cdat, x = "x", y = "y", color = "cell_class", facet.by = "z",
shape = 20, size = 1, palette = pal) +
guides(color = guide_legend(override.aes = list(size = 3)))
The MERFISH mouse hypothalamus dataset is part of the gallery of publicly available MERFISH datasets.
This gallery consists of dedicated iSEE and Vitessce instances, published on RStudioConnect, that enable the interactive exploration of different segmentations, the expression of marker genes, and overlay of cell metadata on a spatial grid or a microscopy image.
sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.5 LTS
#>
#> Matrix products: default
#> BLAS: /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.16-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] ggpubr_0.4.0 ggplot2_3.3.6
#> [3] ExperimentHub_2.6.0 AnnotationHub_3.6.0
#> [5] BiocFileCache_2.6.0 dbplyr_2.2.1
#> [7] MerfishData_1.0.0 SpatialExperiment_1.8.0
#> [9] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0
#> [11] Biobase_2.58.0 GenomicRanges_1.50.0
#> [13] GenomeInfoDb_1.34.0 IRanges_2.32.0
#> [15] S4Vectors_0.36.0 BiocGenerics_0.44.0
#> [17] MatrixGenerics_1.10.0 matrixStats_0.62.0
#> [19] EBImage_4.40.0 BiocStyle_2.26.0
#>
#> loaded via a namespace (and not attached):
#> [1] colorspace_2.0-3 ggsignif_0.6.4
#> [3] rjson_0.2.21 ellipsis_0.3.2
#> [5] scuttle_1.8.0 XVector_0.38.0
#> [7] fftwtools_0.9-11 farver_2.1.1
#> [9] bit64_4.0.5 interactiveDisplayBase_1.36.0
#> [11] AnnotationDbi_1.60.0 fansi_1.0.3
#> [13] codetools_0.2-18 R.methodsS3_1.8.2
#> [15] sparseMatrixStats_1.10.0 cachem_1.0.6
#> [17] knitr_1.40 jsonlite_1.8.3
#> [19] broom_1.0.1 png_0.1-7
#> [21] R.oo_1.25.0 shiny_1.7.3
#> [23] HDF5Array_1.26.0 BiocManager_1.30.19
#> [25] compiler_4.2.1 httr_1.4.4
#> [27] backports_1.4.1 dqrng_0.3.0
#> [29] assertthat_0.2.1 Matrix_1.5-1
#> [31] fastmap_1.1.0 limma_3.54.0
#> [33] cli_3.4.1 later_1.3.0
#> [35] htmltools_0.5.3 tools_4.2.1
#> [37] gtable_0.3.1 glue_1.6.2
#> [39] GenomeInfoDbData_1.2.9 dplyr_1.0.10
#> [41] rappdirs_0.3.3 Rcpp_1.0.9
#> [43] carData_3.0-5 jquerylib_0.1.4
#> [45] vctrs_0.5.0 Biostrings_2.66.0
#> [47] rhdf5filters_1.10.0 DelayedMatrixStats_1.20.0
#> [49] xfun_0.34 stringr_1.4.1
#> [51] beachmat_2.14.0 mime_0.12
#> [53] lifecycle_1.0.3 rstatix_0.7.0
#> [55] edgeR_3.40.0 zlibbioc_1.44.0
#> [57] scales_1.2.1 promises_1.2.0.1
#> [59] parallel_4.2.1 rhdf5_2.42.0
#> [61] yaml_2.3.6 curl_4.3.3
#> [63] memoise_2.0.1 sass_0.4.2
#> [65] stringi_1.7.8 RSQLite_2.2.18
#> [67] highr_0.9 BiocVersion_3.16.0
#> [69] tiff_0.1-11 filelock_1.0.2
#> [71] BiocParallel_1.32.0 rlang_1.0.6
#> [73] pkgconfig_2.0.3 bitops_1.0-7
#> [75] evaluate_0.17 lattice_0.20-45
#> [77] purrr_0.3.5 Rhdf5lib_1.20.0
#> [79] labeling_0.4.2 htmlwidgets_1.5.4
#> [81] bit_4.0.4 tidyselect_1.2.0
#> [83] ggsci_2.9 magrittr_2.0.3
#> [85] bookdown_0.29 R6_2.5.1
#> [87] magick_2.7.3 generics_0.1.3
#> [89] DelayedArray_0.24.0 DBI_1.1.3
#> [91] pillar_1.8.1 withr_2.5.0
#> [93] KEGGREST_1.38.0 abind_1.4-5
#> [95] RCurl_1.98-1.9 tibble_3.1.8
#> [97] car_3.1-1 crayon_1.5.2
#> [99] DropletUtils_1.18.0 utf8_1.2.2
#> [101] rmarkdown_2.17 jpeg_0.1-9
#> [103] locfit_1.5-9.6 grid_4.2.1
#> [105] blob_1.2.3 digest_0.6.30
#> [107] xtable_1.8-4 tidyr_1.2.1
#> [109] httpuv_1.6.6 R.utils_2.12.1
#> [111] munsell_0.5.0 bslib_0.4.0