Contents

1 Introduction

The ggspavis package contains a set of visualization functions for spatially resolved transcriptomics data, designed to work with the SpatialExperiment Bioconductor object class.

These plotting functions are used in our online book OSTA and other work.

2 Examples

Load some example datasets from the STexampleData package and create some example plots.

library(SpatialExperiment)
library(STexampleData)
library(ggspavis)

2.1 10x Genomics Visium: mouse coronal brain section

# load data in SpatialExperiment format
spe <- Visium_mouseCoronal()
# add some values in 'colData' to annotate spots
colData(spe)$sum <- colSums(counts(spe))

# example plots
plotSpots(spe, annotate = "sum")

plotVisium(spe, fill = "sum", trans = "log", highlight = "in_tissue")

2.2 10x Genomics Visium: human brain (DLPFC)

# load data in SpatialExperiment format
spe <- Visium_humanDLPFC()
# example plots
plotSpots(spe, annotate = "ground_truth", palette = "libd_layer_colors")

plotVisium(spe, fill = "ground_truth", highlight = "in_tissue")

2.3 seqFISH: mouse embryo

# load data in SpatialExperiment format
spe <- seqFISH_mouseEmbryo()
# example plots
plotMolecules(spe, molecule = "Sox2")

3 Session information

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] BumpyMatrix_1.6.0           ggspavis_1.4.0             
##  [3] ggplot2_3.3.6               STexampleData_1.5.2        
##  [5] ExperimentHub_2.6.0         AnnotationHub_3.6.0        
##  [7] BiocFileCache_2.6.0         dbplyr_2.2.1               
##  [9] SpatialExperiment_1.8.0     SingleCellExperiment_1.20.0
## [11] SummarizedExperiment_1.28.0 Biobase_2.58.0             
## [13] GenomicRanges_1.50.0        GenomeInfoDb_1.34.0        
## [15] IRanges_2.32.0              S4Vectors_0.36.0           
## [17] BiocGenerics_0.44.0         MatrixGenerics_1.10.0      
## [19] matrixStats_0.62.0          BiocStyle_2.26.0           
## 
## loaded via a namespace (and not attached):
##   [1] colorspace_2.0-3              rjson_0.2.21                 
##   [3] ellipsis_0.3.2                scuttle_1.8.0                
##   [5] XVector_0.38.0                farver_2.1.1                 
##   [7] bit64_4.0.5                   interactiveDisplayBase_1.36.0
##   [9] AnnotationDbi_1.60.0          fansi_1.0.3                  
##  [11] codetools_0.2-18              R.methodsS3_1.8.2            
##  [13] sparseMatrixStats_1.10.0      cachem_1.0.6                 
##  [15] knitr_1.40                    jsonlite_1.8.3               
##  [17] png_0.1-7                     R.oo_1.25.0                  
##  [19] shiny_1.7.3                   HDF5Array_1.26.0             
##  [21] BiocManager_1.30.19           compiler_4.2.1               
##  [23] httr_1.4.4                    dqrng_0.3.0                  
##  [25] assertthat_0.2.1              Matrix_1.5-1                 
##  [27] fastmap_1.1.0                 limma_3.54.0                 
##  [29] cli_3.4.1                     later_1.3.0                  
##  [31] htmltools_0.5.3               tools_4.2.1                  
##  [33] gtable_0.3.1                  glue_1.6.2                   
##  [35] GenomeInfoDbData_1.2.9        dplyr_1.0.10                 
##  [37] rappdirs_0.3.3                Rcpp_1.0.9                   
##  [39] jquerylib_0.1.4               vctrs_0.5.0                  
##  [41] Biostrings_2.66.0             rhdf5filters_1.10.0          
##  [43] DelayedMatrixStats_1.20.0     xfun_0.34                    
##  [45] stringr_1.4.1                 beachmat_2.14.0              
##  [47] mime_0.12                     lifecycle_1.0.3              
##  [49] edgeR_3.40.0                  zlibbioc_1.44.0              
##  [51] scales_1.2.1                  promises_1.2.0.1             
##  [53] parallel_4.2.1                rhdf5_2.42.0                 
##  [55] yaml_2.3.6                    curl_4.3.3                   
##  [57] memoise_2.0.1                 sass_0.4.2                   
##  [59] stringi_1.7.8                 RSQLite_2.2.18               
##  [61] highr_0.9                     BiocVersion_3.16.0           
##  [63] filelock_1.0.2                BiocParallel_1.32.0          
##  [65] ggside_0.2.1                  rlang_1.0.6                  
##  [67] pkgconfig_2.0.3               bitops_1.0-7                 
##  [69] evaluate_0.17                 lattice_0.20-45              
##  [71] purrr_0.3.5                   Rhdf5lib_1.20.0              
##  [73] labeling_0.4.2                bit_4.0.4                    
##  [75] tidyselect_1.2.0              magrittr_2.0.3               
##  [77] bookdown_0.29                 R6_2.5.1                     
##  [79] magick_2.7.3                  generics_0.1.3               
##  [81] DelayedArray_0.24.0           DBI_1.1.3                    
##  [83] pillar_1.8.1                  withr_2.5.0                  
##  [85] KEGGREST_1.38.0               RCurl_1.98-1.9               
##  [87] tibble_3.1.8                  crayon_1.5.2                 
##  [89] DropletUtils_1.18.0           utf8_1.2.2                   
##  [91] rmarkdown_2.17                locfit_1.5-9.6               
##  [93] grid_4.2.1                    blob_1.2.3                   
##  [95] digest_0.6.30                 xtable_1.8-4                 
##  [97] httpuv_1.6.6                  R.utils_2.12.1               
##  [99] munsell_0.5.0                 viridisLite_0.4.1            
## [101] bslib_0.4.0