scplotter to work with 10x VisiumHD data prepared by Seurat¶

Go back to scplotter documentation: https://pwwang.github.io/scplotter/

InĀ [1]:
suppressPackageStartupMessages({
    library(Seurat)
})
# Load the scplotter package
# library(scplotter)
devtools::load_all()
# devtools::load_all("../../../plotthis")
ℹ Loading scplotter
InĀ [2]:
# https://www.10xgenomics.com/datasets/visium-hd-cytassist-gene-expression-libraries-of-mouse-intestine
counts <- Read10X_h5("data/Visium_HD_Mouse_Small_Intestine/binned_outputs/square_008um/filtered_feature_bc_matrix.h5")
# Create a Seurat object
object <- CreateSeuratObject(counts = counts, assay = "Spatial", project = "Visium_HD_Mouse_Small_Intestine")
# Add spatial coordinates
object[["slice1"]] <- Read10X_Image("data/Visium_HD_Mouse_Small_Intestine/binned_outputs/square_008um/spatial/")
object <- NormalizeData(object)
object
Warning message:
ā€œAdding image with unordered cellsā€
Normalizing layer: counts

An object of class Seurat 
19059 features across 351817 samples within 1 assay 
Active assay: Spatial (19059 features, 0 variable features)
 2 layers present: counts, data
 1 spatial field of view present: slice1
InĀ [6]:
options(repr.plot.width = 12, repr.plot.height = 6)

plot1 <- FeatureStatPlot(object, features = "nCount_Spatial",
    ident = "orig.ident", add_point = TRUE, legend.position = "none")
plot2 <- SpatFeaturePlot(object, features = "nCount_Spatial")

plot1 + plot2
No description has been provided for this image
InĀ [7]:
SpatFeaturePlot(object, features = c("Ighm", "Jchain"))
No description has been provided for this image
InĀ [8]:
# simulate the clustering
set.seed(8525)
object$seurat_clusters <- paste0("c", sample(1:5, ncol(object), replace = TRUE))
Idents(object) <- "seurat_clusters"

options(repr.plot.width = 6, repr.plot.height = 5)
SpatDimPlot(object)
No description has been provided for this image
InĀ [2]:
x <- sessionInfo()
x <- capture.output(print(x))
# hide the BLAS/LAPACK paths
x <- x[!startsWith(x, "BLAS/LAPACK:")]
cat(paste(x, collapse = "\n"))
R version 4.4.3 (2025-02-28)
Platform: x86_64-conda-linux-gnu
Running under: Red Hat Enterprise Linux 8.10 (Ootpa)

Matrix products: default

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        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/Chicago
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] scplotter_0.4.0    Seurat_5.3.0       SeuratObject_5.1.0 sp_2.2-0          

loaded via a namespace (and not attached):
  [1] cubature_2.1.4              RcppAnnoy_0.0.22           
  [3] splines_4.4.3               later_1.4.2                
  [5] pbdZMQ_0.3-14               bitops_1.0-9               
  [7] tibble_3.2.1                polyclip_1.10-7            
  [9] fastDummies_1.7.5           lifecycle_1.0.4            
 [11] rprojroot_2.0.4             globals_0.18.0             
 [13] lattice_0.22-7              MASS_7.3-64                
 [15] magrittr_2.0.3              plotly_4.10.4              
 [17] remotes_2.5.0               httpuv_1.6.15              
 [19] sctransform_0.4.2           spam_2.11-1                
 [21] sessioninfo_1.2.3           pkgbuild_1.4.8             
 [23] spatstat.sparse_3.1-0       reticulate_1.42.0          
 [25] cowplot_1.1.3               pbapply_1.7-2              
 [27] RColorBrewer_1.1-3          abind_1.4-5                
 [29] pkgload_1.4.0               zlibbioc_1.48.2            
 [31] Rtsne_0.17                  GenomicRanges_1.54.1       
 [33] purrr_1.0.4                 ggraph_2.2.1               
 [35] BiocGenerics_0.48.1         RCurl_1.98-1.17            
 [37] tweenr_2.0.3                evmix_2.12                 
 [39] circlize_0.4.16             GenomeInfoDbData_1.2.11    
 [41] IRanges_2.36.0              S4Vectors_0.40.2           
 [43] ggrepel_0.9.6               irlba_2.3.5.1              
 [45] listenv_0.9.1               spatstat.utils_3.1-4       
 [47] iNEXT_3.0.1                 MatrixModels_0.5-4         
 [49] goftest_1.2-3               RSpectra_0.16-2            
 [51] scRepertoire_2.2.1          spatstat.random_3.4-1      
 [53] fitdistrplus_1.2-2          parallelly_1.45.0          
 [55] codetools_0.2-20            DelayedArray_0.28.0        
 [57] xml2_1.3.8                  ggforce_0.4.2              
 [59] shape_1.4.6.1               tidyselect_1.2.1           
 [61] farver_2.1.2                viridis_0.6.5              
 [63] matrixStats_1.5.0           stats4_4.4.3               
 [65] base64enc_0.1-3             spatstat.explore_3.4-3     
 [67] jsonlite_2.0.0              tidygraph_1.3.0            
 [69] ellipsis_0.3.2              progressr_0.15.1           
 [71] ggridges_0.5.6              ggalluvial_0.12.5          
 [73] survival_3.8-3              ggnewscale_0.5.1           
 [75] tools_4.4.3                 stringdist_0.9.15          
 [77] ica_1.0-3                   Rcpp_1.0.14                
 [79] glue_1.8.0                  gridExtra_2.3              
 [81] SparseArray_1.2.4           MatrixGenerics_1.14.0      
 [83] usethis_3.1.0               GenomeInfoDb_1.38.8        
 [85] IRdisplay_1.1               dplyr_1.1.4                
 [87] withr_3.0.2                 fastmap_1.2.0              
 [89] SparseM_1.84-2              digest_0.6.37              
 [91] R6_2.6.1                    mime_0.13                  
 [93] colorspace_2.1-1            scattermore_1.2            
 [95] tensor_1.5                  spatstat.data_3.1-6        
 [97] tidyr_1.3.1                 generics_0.1.4             
 [99] data.table_1.17.4           graphlayouts_1.2.2         
[101] httr_1.4.7                  htmlwidgets_1.6.4          
[103] S4Arrays_1.2.1              uwot_0.2.3                 
[105] pkgconfig_2.0.3             gtable_0.3.6               
[107] lmtest_0.9-40               SingleCellExperiment_1.24.0
[109] XVector_0.42.0              htmltools_0.5.8.1          
[111] profvis_0.4.0               dotCall64_1.2              
[113] scales_1.4.0                Biobase_2.62.0             
[115] png_0.1-8                   spatstat.univar_3.1-3      
[117] ggdendro_0.2.0              rstudioapi_0.17.1          
[119] rjson_0.2.23                reshape2_1.4.4             
[121] uuid_1.2-1                  nlme_3.1-168               
[123] GlobalOptions_0.1.2         repr_1.1.7                 
[125] cachem_1.1.0                zoo_1.8-14                 
[127] stringr_1.5.1               KernSmooth_2.23-26         
[129] parallel_4.4.3              miniUI_0.1.2               
[131] desc_1.4.3                  pillar_1.10.2              
[133] grid_4.4.3                  vctrs_0.6.5                
[135] RANN_2.6.2                  urlchecker_1.0.1           
[137] VGAM_1.1-13                 promises_1.3.2             
[139] xtable_1.8-4                cluster_2.1.8.1            
[141] evaluate_1.0.3              truncdist_1.0-2            
[143] cli_3.6.5                   compiler_4.4.3             
[145] rlang_1.1.6                 crayon_1.5.3               
[147] future.apply_1.20.0         forcats_1.0.0              
[149] plyr_1.8.9                  fs_1.6.6                   
[151] stringi_1.8.7               viridisLite_0.4.2          
[153] deldir_2.0-4                assertthat_0.2.1           
[155] gsl_2.1-8                   lazyeval_0.2.2             
[157] devtools_2.4.5              spatstat.geom_3.4-1        
[159] quantreg_6.00               Matrix_1.7-3               
[161] IRkernel_1.3.2              RcppHNSW_0.6.0             
[163] patchwork_1.3.0             future_1.58.0              
[165] ggplot2_3.5.2               shiny_1.10.0               
[167] plotthis_0.7.0              SummarizedExperiment_1.32.0
[169] evd_2.3-7.1                 ROCR_1.0-11                
[171] gridtext_0.1.5              igraph_2.0.3               
[173] memoise_2.0.1