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)
## Warning: replacing previous import 'utils::findMatches' by
## 'S4Vectors::findMatches' when loading 'AnnotationDbi'
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.3.0 RC (2023-04-13 r84269)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## 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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] BumpyMatrix_1.8.0           ggspavis_1.6.0             
##  [3] ggplot2_3.4.2               STexampleData_1.7.0        
##  [5] ExperimentHub_2.8.0         AnnotationHub_3.8.0        
##  [7] BiocFileCache_2.8.0         dbplyr_2.3.2               
##  [9] SpatialExperiment_1.10.0    SingleCellExperiment_1.22.0
## [11] SummarizedExperiment_1.30.0 Biobase_2.60.0             
## [13] GenomicRanges_1.52.0        GenomeInfoDb_1.36.0        
## [15] IRanges_2.34.0              S4Vectors_0.38.0           
## [17] BiocGenerics_0.46.0         MatrixGenerics_1.12.0      
## [19] matrixStats_0.63.0          BiocStyle_2.28.0           
## 
## loaded via a namespace (and not attached):
##  [1] DBI_1.1.3                     bitops_1.0-7                 
##  [3] rlang_1.1.0                   magrittr_2.0.3               
##  [5] compiler_4.3.0                RSQLite_2.3.1                
##  [7] DelayedMatrixStats_1.22.0     png_0.1-8                    
##  [9] vctrs_0.6.2                   pkgconfig_2.0.3              
## [11] crayon_1.5.2                  fastmap_1.1.1                
## [13] magick_2.7.4                  XVector_0.40.0               
## [15] ellipsis_0.3.2                labeling_0.4.2               
## [17] scuttle_1.10.0                utf8_1.2.3                   
## [19] promises_1.2.0.1              rmarkdown_2.21               
## [21] purrr_1.0.1                   bit_4.0.5                    
## [23] xfun_0.39                     zlibbioc_1.46.0              
## [25] cachem_1.0.7                  beachmat_2.16.0              
## [27] jsonlite_1.8.4                blob_1.2.4                   
## [29] highr_0.10                    later_1.3.0                  
## [31] rhdf5filters_1.12.0           DelayedArray_0.26.0          
## [33] Rhdf5lib_1.22.0               BiocParallel_1.34.0          
## [35] interactiveDisplayBase_1.38.0 parallel_4.3.0               
## [37] R6_2.5.1                      bslib_0.4.2                  
## [39] limma_3.56.0                  jquerylib_0.1.4              
## [41] Rcpp_1.0.10                   bookdown_0.33                
## [43] knitr_1.42                    R.utils_2.12.2               
## [45] httpuv_1.6.9                  Matrix_1.5-4                 
## [47] tidyselect_1.2.0              yaml_2.3.7                   
## [49] codetools_0.2-19              curl_5.0.0                   
## [51] lattice_0.21-8                tibble_3.2.1                 
## [53] shiny_1.7.4                   withr_2.5.0                  
## [55] KEGGREST_1.40.0               evaluate_0.20                
## [57] Biostrings_2.68.0             pillar_1.9.0                 
## [59] BiocManager_1.30.20           filelock_1.0.2               
## [61] generics_0.1.3                RCurl_1.98-1.12              
## [63] BiocVersion_3.17.1            munsell_0.5.0                
## [65] scales_1.2.1                  sparseMatrixStats_1.12.0     
## [67] xtable_1.8-4                  glue_1.6.2                   
## [69] tools_4.3.0                   locfit_1.5-9.7               
## [71] ggside_0.2.2                  rhdf5_2.44.0                 
## [73] grid_4.3.0                    colorspace_2.1-0             
## [75] DropletUtils_1.20.0           AnnotationDbi_1.62.0         
## [77] edgeR_3.42.0                  GenomeInfoDbData_1.2.10      
## [79] HDF5Array_1.28.0              cli_3.6.1                    
## [81] rappdirs_0.3.3                fansi_1.0.4                  
## [83] viridisLite_0.4.1             dplyr_1.1.2                  
## [85] gtable_0.3.3                  R.methodsS3_1.8.2            
## [87] sass_0.4.5                    digest_0.6.31                
## [89] dqrng_0.3.0                   farver_2.1.1                 
## [91] rjson_0.2.21                  memoise_2.0.1                
## [93] htmltools_0.5.5               R.oo_1.25.0                  
## [95] lifecycle_1.0.3               httr_1.4.5                   
## [97] mime_0.12                     bit64_4.0.5