Starting from Version 1.2.0, escheR
package supports additional two data structures as input, including SpatialExperiment
and data.frame
from base
R. In addition, escheR
supports in-situ visualization of image-based spatially resolved data, which will be the focus of future development.
SingleCellExperiment
SpatialExperiment
inherits SingleCellExperiment
Following the same syntax, one can also visualize dimensionality reduced embeddings of a SpatialExperiment
object by providing the argument dimred
with a non-null value. Hence, the first 2 columns of the corresponding reducedDim(spe)
assay will be used as the x-y coordinate of the plot, replacing spatialCoords(spe)
.
library(escheR)
library(STexampleData)
library(scater)
library(scran)
spe <- Visium_humanDLPFC() |>
logNormCounts()
top.gene <- getTopHVGs(spe, n=500)
set.seed(100) # See below.
spe <- runPCA(spe, subset_row = top.gene)
make_escheR(
spe,
dimred = "PCA"
) |>
add_fill(var = "ground_truth") +
theme_minimal()
SpatialExperiment
ObjectTo demonstrate the principle that escheR
can be used to visualize image-based spatially-resolved data pending optimization, we include two image-based spatially resolved transcriptomics data generated via seqFish platform and Slide-seq V2 platform respectively. The two datasets have been previously curated in the STexampleData
package
library(STexampleData)
library(escheR)
spe_seqFISH <- seqFISH_mouseEmbryo()
make_escheR(spe_seqFISH) |>
add_fill(var = "embryo")
NOTE: trimming down the
colData(spe)
before piping into make-escheR could reduce the computation time to make the plots, specifically whencolData(spe)
contains extremely large number of irrelavent features/columns.
We aim to provide accessibility to all users regardless of their programming background and preferred single-cell analysis pipelines. Nevertheless , with limited resource, our sustaining efforts will prioritize towards the maintenance of the established functionality and the optimization for image-based spatially resolved data. We regret we are not be able to provide seamless interface to other R pipelines such as Seurat
and Giotto
in foreseeable future.
Instead, we provide a generic function that works with a data.frame
object as input. For example, relevant features in Suerat
can be easily exported as a data.frame
object manually or via tidyseurat
[https://github.com/stemangiola/tidyseurat]. The exported data frame can be pipe into escheR
.
library(escheR)
library(Seurat)
pbmc_small <- SeuratObject::pbmc_small
pbmc_2pc <- pbmc_small@reductions$pca@cell.embeddings[,1:2]
pbmc_meta <- pbmc_small@meta.data
#> Call generic function for make_escheR.data.frame
make_escheR(
object = pbmc_meta,
.x = pbmc_2pc[,1],
.y = pbmc_2pc[,2]) |>
add_fill(var = "groups")
utils::sessionInfo()
#> R version 4.3.2 Patched (2023-11-01 r85457)
#> Platform: x86_64-apple-darwin20 (64-bit)
#> Running under: macOS Monterey 12.7.1
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> time zone: America/New_York
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats4 stats graphics grDevices utils datasets methods
#> [8] base
#>
#> other attached packages:
#> [1] BumpyMatrix_1.10.0 scran_1.30.0
#> [3] scater_1.30.0 scuttle_1.12.0
#> [5] ggpubr_0.6.0 STexampleData_1.10.0
#> [7] SpatialExperiment_1.12.0 SingleCellExperiment_1.24.0
#> [9] SummarizedExperiment_1.32.0 Biobase_2.62.0
#> [11] GenomicRanges_1.54.1 GenomeInfoDb_1.38.1
#> [13] IRanges_2.36.0 S4Vectors_0.40.1
#> [15] MatrixGenerics_1.14.0 matrixStats_1.1.0
#> [17] ExperimentHub_2.10.0 AnnotationHub_3.10.0
#> [19] BiocFileCache_2.10.1 dbplyr_2.4.0
#> [21] BiocGenerics_0.48.1 escheR_1.2.0
#> [23] ggplot2_3.4.4 BiocStyle_2.30.0
#>
#> loaded via a namespace (and not attached):
#> [1] RColorBrewer_1.1-3 jsonlite_1.8.7
#> [3] magrittr_2.0.3 ggbeeswarm_0.7.2
#> [5] magick_2.8.1 farver_2.1.1
#> [7] rmarkdown_2.25 zlibbioc_1.48.0
#> [9] vctrs_0.6.4 memoise_2.0.1
#> [11] DelayedMatrixStats_1.24.0 RCurl_1.98-1.13
#> [13] rstatix_0.7.2 htmltools_0.5.7
#> [15] S4Arrays_1.2.0 curl_5.1.0
#> [17] BiocNeighbors_1.20.0 broom_1.0.5
#> [19] SparseArray_1.2.2 sass_0.4.7
#> [21] bslib_0.5.1 cachem_1.0.8
#> [23] igraph_1.5.1 mime_0.12
#> [25] lifecycle_1.0.4 pkgconfig_2.0.3
#> [27] rsvd_1.0.5 Matrix_1.6-2
#> [29] R6_2.5.1 fastmap_1.1.1
#> [31] GenomeInfoDbData_1.2.11 shiny_1.7.5.1
#> [33] digest_0.6.33 colorspace_2.1-0
#> [35] AnnotationDbi_1.64.1 dqrng_0.3.1
#> [37] irlba_2.3.5.1 RSQLite_2.3.3
#> [39] beachmat_2.18.0 filelock_1.0.2
#> [41] labeling_0.4.3 fansi_1.0.5
#> [43] httr_1.4.7 abind_1.4-5
#> [45] compiler_4.3.2 bit64_4.0.5
#> [47] withr_2.5.2 backports_1.4.1
#> [49] BiocParallel_1.36.0 carData_3.0-5
#> [51] viridis_0.6.4 DBI_1.1.3
#> [53] highr_0.10 ggsignif_0.6.4
#> [55] rappdirs_0.3.3 DelayedArray_0.28.0
#> [57] rjson_0.2.21 bluster_1.12.0
#> [59] tools_4.3.2 vipor_0.4.5
#> [61] beeswarm_0.4.0 interactiveDisplayBase_1.40.0
#> [63] httpuv_1.6.12 glue_1.6.2
#> [65] promises_1.2.1 grid_4.3.2
#> [67] cluster_2.1.4 generics_0.1.3
#> [69] gtable_0.3.4 tidyr_1.3.0
#> [71] metapod_1.10.0 BiocSingular_1.18.0
#> [73] ScaledMatrix_1.10.0 car_3.1-2
#> [75] utf8_1.2.4 XVector_0.42.0
#> [77] ggrepel_0.9.4 BiocVersion_3.18.0
#> [79] pillar_1.9.0 limma_3.58.1
#> [81] later_1.3.1 dplyr_1.1.3
#> [83] lattice_0.22-5 bit_4.0.5
#> [85] tidyselect_1.2.0 locfit_1.5-9.8
#> [87] Biostrings_2.70.1 knitr_1.45
#> [89] gridExtra_2.3 bookdown_0.36
#> [91] edgeR_4.0.1 xfun_0.41
#> [93] statmod_1.5.0 yaml_2.3.7
#> [95] evaluate_0.23 codetools_0.2-19
#> [97] tibble_3.2.1 BiocManager_1.30.22
#> [99] cli_3.6.1 xtable_1.8-4
#> [101] munsell_0.5.0 jquerylib_0.1.4
#> [103] Rcpp_1.0.11 png_0.1-8
#> [105] parallel_4.3.2 ellipsis_0.3.2
#> [107] blob_1.2.4 sparseMatrixStats_1.14.0
#> [109] bitops_1.0-7 viridisLite_0.4.2
#> [111] scales_1.2.1 purrr_1.0.2
#> [113] crayon_1.5.2 rlang_1.1.2
#> [115] cowplot_1.1.1 KEGGREST_1.42.0