Preprocess
Before create SpaTalk object, we suggest to revise gene symbols of ST data matrix
and scRNA-seq data matrix
using rev_gene()
library(SpaTalk)
# load starmap data
load(paste0(system.file(package = 'SpaTalk'), "/extdata/starmap_data.rda"))
load(paste0(system.file(package = 'SpaTalk'), "/extdata/starmap_meta.rda"))
# revise gene symbols according to the NCNI gene symbols
<- rev_gene(data = as.matrix(starmap_data),
starmap_data data_type = "count",
species = "Mouse",
geneinfo = geneinfo)
## Revising gene symbols for count data
## ***Done***
Note
In order to guide users on how to create the right data type, we provide several demo_data
to follow:
# demo spot-based ST data
demo_st_data()
## spot1 spot2 spot3 spot4 spot5 spot6
## A1BG 0 0 0 0 0 18
## A2M 37 0 39 19 0 47
## A2MP 44 7 0 19 0 23
## NAT1 14 0 16 0 26 0
## NAT2 15 7 0 0 0 18
## NAT20 5 0 0 0 11 0
# demo spot-based ST meta
demo_st_meta()
## spot x y
## 1 spot1 6 17
## 2 spot2 2 8
## 3 spot3 14 14
## 4 spot4 3 2
## 5 spot5 14 14
## 6 spot6 8 12
# demo single-cell ST data
demo_st_sc_data()
## cell1 cell2 cell3 cell4 cell5 cell6
## A1BG 45 0 19 0 0 17
## A2M 10 0 9 0 12 0
## A2MP 20 0 0 37 45 0
## NAT1 38 0 31 26 0 7
## NAT2 0 0 0 50 0 2
## NAT20 50 25 45 33 3 5
# demo single-cell ST meta
demo_st_sc_meta()
## cell x y
## 1 cell1 3 3
## 2 cell2 14 10
## 3 cell3 4 10
## 4 cell4 10 12
## 5 cell5 1 20
## 6 cell6 17 19
# demo scRNA-seq data
demo_sc_data()
## cell1 cell2 cell3 cell4 cell5 cell6
## A1BG 0 19 0 36 2 0
## A2M 0 0 0 0 0 0
## A2MP 31 14 49 7 6 45
## NAT1 0 22 3 0 0 0
## NAT2 5 44 0 0 0 22
## NATP 0 16 0 4 7 0
# demo geneinfo
demo_geneinfo()
## symbol synonyms species
## 1 A1BG A1B Human
## 2 A1BG ABG Human
## 3 A2MP1 A2MP Human
## 4 Aco1 Aco Mouse
After revising gene symbols, we create a SpaTalk object with st_data and st_meta. Given the two types of ST data, namely single-cell and spot-based ST data, we provided two standard processing examples. Please refer to:
spot-based tutorial vignette
sessionInfo()
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19044)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=Chinese (Simplified)_China.936
## [2] LC_CTYPE=Chinese (Simplified)_China.936
## [3] LC_MONETARY=Chinese (Simplified)_China.936
## [4] LC_NUMERIC=C
## [5] LC_TIME=Chinese (Simplified)_China.936
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] SpaTalk_1.0
##
## loaded via a namespace (and not attached):
## [1] Seurat_4.0.5 Rtsne_0.15 colorspace_2.0-2
## [4] ggsignif_0.6.3 deldir_1.0-6 ellipsis_0.3.2
## [7] ggridges_0.5.3 spatstat.data_2.1-0 ggpubr_0.4.0
## [10] leiden_0.3.9 listenv_0.8.0 farver_2.1.0
## [13] ggrepel_0.9.1 fansi_0.5.0 scatterpie_0.1.7
## [16] codetools_0.2-18 splines_4.1.1 knitr_1.36
## [19] polyclip_1.10-0 jsonlite_1.7.2 broom_0.7.10
## [22] ica_1.0-2 cluster_2.1.2 png_0.1-7
## [25] uwot_0.1.10 pheatmap_1.0.12 spatstat.sparse_2.0-0
## [28] ggforce_0.3.3 shiny_1.7.1 sctransform_0.3.2
## [31] compiler_4.1.1 httr_1.4.2 backports_1.3.0
## [34] assertthat_0.2.1 SeuratObject_4.0.2 Matrix_1.3-4
## [37] fastmap_1.1.0 lazyeval_0.2.2 later_1.3.0
## [40] tweenr_1.0.2 htmltools_0.5.2 prettyunits_1.1.1
## [43] tools_4.1.1 igraph_1.2.7 gtable_0.3.0
## [46] glue_1.4.2 RANN_2.6.1 reshape2_1.4.4
## [49] dplyr_1.0.7 Rcpp_1.0.7 carData_3.0-4
## [52] scattermore_0.7 jquerylib_0.1.4 vctrs_0.3.8
## [55] nlme_3.1-152 ggalluvial_0.12.3 lmtest_0.9-38
## [58] xfun_0.30 stringr_1.4.0 globals_0.14.0
## [61] mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.1
## [64] irlba_2.3.3 rstatix_0.7.0 goftest_1.2-3
## [67] NNLM_0.4.4 future_1.23.0 MASS_7.3-54
## [70] zoo_1.8-9 scales_1.1.1 spatstat.core_2.3-0
## [73] spatstat.utils_2.2-0 hms_1.1.1 promises_1.2.0.1
## [76] parallel_4.1.1 RColorBrewer_1.1-2 yaml_2.2.1
## [79] reticulate_1.22 pbapply_1.5-0 gridExtra_2.3
## [82] ggplot2_3.3.5 ggfun_0.0.4 sass_0.4.0
## [85] rpart_4.1-15 ggExtra_0.9 stringi_1.7.5
## [88] rlang_0.4.12 pkgconfig_2.0.3 matrixStats_0.61.0
## [91] evaluate_0.14 lattice_0.20-44 tensor_1.5
## [94] ROCR_1.0-11 purrr_0.3.4 patchwork_1.1.1
## [97] htmlwidgets_1.5.4 cowplot_1.1.1 tidyselect_1.1.1
## [100] parallelly_1.28.1 RcppAnnoy_0.0.19 plyr_1.8.6
## [103] magrittr_2.0.1 R6_2.5.1 generics_0.1.1
## [106] DBI_1.1.1 mgcv_1.8-36 pillar_1.6.4
## [109] fitdistrplus_1.1-6 prettydoc_0.4.1 abind_1.4-5
## [112] survival_3.2-11 tibble_3.1.5 future.apply_1.8.1
## [115] car_3.0-12 crayon_1.4.2 KernSmooth_2.23-20
## [118] utf8_1.2.2 spatstat.geom_2.3-0 plotly_4.10.0
## [121] rmarkdown_2.13 progress_1.2.2 grid_4.1.1
## [124] data.table_1.14.2 digest_0.6.28 xtable_1.8-4
## [127] tidyr_1.1.4 httpuv_1.6.3 munsell_0.5.0
## [130] viridisLite_0.4.0 bslib_0.3.1