Learn R Programming

spatialGE

An R package for the visualization and analysis of spatially-resolved transcriptomics data, such as those generated with 10X Visium. The spatialGE package features a data object (STlist: Spatial Transctiptomics List) to store data and results from multiple tissue sections, as well as associated analytical methods for:

  • Visualization: STplot, gene_interpolation, STplot_interpolation to explore gene

expression in spatial context.

  • Spatial autocorrelation: SThet, compare_SThet to assess the level of spatial uniformity in

gene expression by calculating Moran's I and/or Geary's C and qualitatively explore correlations with sample-level metadata (i.e., tissue type, therapy, disease status).

  • Tissue domain/niche detection: STclust to perform spatially-informed hierarchical clustering for

prediction of tissue domains in samples.

  • Gene set spatial enrichment: STenrich to detect gene sets with indications of spatial

patterns (i.e., non-spatially uniform gene set expression).

  • Gene expression spatial gradients: STgradient to detect genes with evidence of variation in

expression with respect to a tissue domain.

  • Spatially-informed differential expression: STdiff to test for differentially expressed

genes using mixed models with spatial covariance structures to account of spatial dependency among spots/cells. It also supports non-spatial tests (Wilcoxon's and T-test).

The methods in the initial spatialGE release, technical details, and their utility are presented in this publication: https://doi.org/10.1093/bioinformatics/btac145. For details on the recently developed methods STenrich, STgradient, and STdiff please refer to the spatialGE documentation.

Installation

The spatialGE repository is available at GitHub and can be installed via devtools.

options(timeout=9999999) # To avoid R closing connection with GitHub
devtools::install_github("fridleylab/spatialGE")

How to use spatialGE

For tutorials on how to use spatialGE, please go to: https://fridleylab.github.io/spatialGE/

The code for spatialGE can be found here: https://github.com/FridleyLab/spatialGE

spatialGE-Web

A point-and-click web application that allows using spatialGE without coding/scripting is available at https://spatialge.moffitt.org . The web app currently supports Visium outputs and csv/tsv gene expression files paired with csv/tsv coordinate files.

How to cite

When using spatialGE, please cite the following publication:

Ospina, O. E., Wilson C. M., Soupir, A. C., Berglund, A. Smalley, I., Tsai, K. Y., Fridley, B. L. 2022. spatialGE: quantification and visualization of the tumor microenvironment heterogeneity using spatial transcriptomics. Bioinformatics, 38:2645-2647. https://doi.org/10.1093/bioinformatics/btac145

Copy Link

Version

Install

install.packages('spatialGE')

Monthly Downloads

322

Version

1.2.2

License

MIT + file LICENSE

Maintainer

Oscar Ospina

Last Published

June 4th, 2025

Functions in spatialGE (1.2.2)

filter_data

filter_data: Filters cells/spots, genes, or samples
plot_image

plot_image: Generate a ggplot object of the tissue image
distribution_plots

per_unit_counts: Generates distribution plots of spot/cell meta data or gene expression
gene_interpolation

gene_interpolation: Spatial interpolation of gene expression
compare_SThet

compare_SThet: Compares spatial autocorrelation statistics across samples
pseudobulk_dim_plot

pseudobulk_dim_plot: Plot PCA of pseudobulk samples
load_images

load_images: Place tissue images within STlist
dim,STlist-method

dim: Prints the dimensions of count arrays within an STList object.
get_gene_meta

get_gene_meta: Extract gene-level metadata and statistics
summarize_STlist

summarize_STlist: Generates a data frame with summary statistics
spatial_metadata

spatial_metadata: Prints the names of the available spot/cell annotations
plot_counts

plot_counts: Generates plots for the distribution of counts
show,STlist-method

show: Prints overview of STList oject.
summary,STlist-method

summary: Prints overview of STList oject.
transform_data

transform_data: Transformation of spatial transcriptomics data
tissue_names

tissue_names: Prints the names of the tissue samples in the STlist
pseudobulk_heatmap

pseudobulk_heatmap: Heatmap of pseudobulk samples
pseudobulk_samples

pseudobulk_samples: Aggregates counts into "pseudo bulk" samples
STclust

STclust: Detect clusters of spots/cells
STgradient

STgradient: Tests of gene expression spatial gradients
STplot

STplot: Plots of gene expression, cluster memberships, and metadata in spatial context
STdiff_volcano

STdiff_volcano: Generates volcano plots from STdiff results
STdiff

STdiff: Differential gene expression analysis for spatial transcriptomics data
STplot_interpolation

STplot_interpolation: Visualize gene expression surfaces
STlist-class

Definition of an STlist object class.
STenrich

STenrich
STlist

STlist: Creation of STlist objects for spatial transcriptomics analysis
SThet

SThet: Computes global spatial autocorrelation statistics on gene expression