Welcome to the PSF Spatial Browser app! This application is designed for interactive exploration of pathway activity analysis results from spatial transcriptomic datasets. Pathway activity analysis is conducted using the Pathway Signal Flow (PSF) algorithm, which is implemented in the PSF toolkit R package [1]. PSF utilizes gene expression data in combination with pathway topology and interaction information to calculate branch-level activity within pathways [2].
With this app, you can visualize gene expression and pathway activity values on spatial tissue slices and rendered pathway networks. Both visualization sections are interactive, allowing for detailed exploration of the spatial transcriptomics data. The PSF Spatial Browser aims to provide a tool for users interested in a functional analysis of spatial transcriptomics datasets with focus on topology rich pathway networks.
The user interface consists of two main sections: the side panel with widgets and the main panel with interactive plots.
The main panel contains the interactive spatial plot and pathway networks:
The interactive interface is designed to make spatial transcriptomic exploration and analysis intuitive and informative.
In this use case, we explore the spatial transcriptomics dataset of human melanoma from 10x Genomics public datasets. This example demonstrates the initial data processing, pathway analysis, and interactive data exploration with the PSF Spatial Browser app. The following guide provides a step by step tutorial to analyze spatial transcriptomics data and run the PSF Spatial Browser locally. A demo version of the app for this dataset is available at this link.
First, download the desired spatial dataset from the 10x Genomics Data Portal and create a spatial dataset directory.
Next, clone the GitHub repository containing all necessary scripts and functions for spatial transcriptomics data analysis:
git clone https://github.com/hakobyansiras/PSF_spatial.git
Install all the required R packages:
remotes::install_github("hakobyansiras/psf")
if (!require("BiocManager", quietly = TRUE)) {install.packages("BiocManager")}
BiocManager::install("biomaRt")
install.packages(c("ggplot2", "patchwork", "dplyr", "data.table", "DT", "miniUI", "shiny", "Seurat", "psf", "magick", "shinyjs", "visNetwork", "biomaRt", "SeuratData"))
Then, load the required R functions from the downloaded repository:
source("Spatial_psf_analysis.R")
source("psf_spatial_browser.R")
Load your spatial dataset using the Load10X_Spatial() function:
spatial_melanoma <- Load10X_Spatial("/data/spacial_melanoma_psf/spatial_data", filename = "CytAssist_FFPE_Human_Skin_Melanoma_filtered_feature_bc_matrix.h5")
You can download gene symbol to Entrez ID conversion data or use the preloaded version:
# ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl")
# gene_symbol_to_entrez <- getBM(attributes=c('entrezgene_id', 'hgnc_symbol'), mart = ensembl)
# gene_symbol_to_entrez <- gene_symbol_to_entrez[which(!is.na(gene_symbol_to_entrez$entrezgene_id)),]
# gene_symbol_to_entrez <- gene_symbol_to_entrez[which(!duplicated(gene_symbol_to_entrez$entrezgene_id)),]
# gene_symbol_to_entrez <- setNames(object = gene_symbol_to_entrez$entrezgene_id, nm = gene_symbol_to_entrez$hgnc_symbol)
load("gene_symbol_to_entrez.RData")
Load KEGG signaling pathways:
load(system.file("extdata", "kegg_curated_40_signalings.RData", package="psf"))
load(system.file("extdata", "kegg_sink_to_process.RData", package="psf"))
Run pathway analysis using the spatial_psf_analysis() function:
psf_spatial <- spatial_psf_analysis(spatial_obj = spatial_melanoma, pathway_collection = kegg_curated_40_signalings, gene_symbol_to_entrez = gene_symbol_to_entrez, nthreads = 30)
Launch the PSF Spatial Browser application:
run_psf_spatial_browser(psf_saptial_results = psf_spatial)
Once the app launches, you can begin exploring the analysis results interactively.
Cluster 3 in this dataset displays distinct features and appears to be localized in a specific tissue area. Select this cluster using the “Select Cluster” widget. After selecting Cluster 3, the cluster spots are highlighted on the spatial plot.
When cluster is selected feature selction widget will be updated to include cluster assoicated significant features. To visualize pathway activity of those, select a feature, such as the terminal node BIRC2 in the Hippo signaling pathway. The Hippo pathway is known to regulate organ growth and cell fate.
Afte selecting the feature the pathway network is rendered, with BIRC2 highlighted in green, and color-coded activity values of BIRC2 gene are displayed on the spatial plot.
By examining the color-coded pathway nodes, you can observe the high activity of YAP1 gene. This gene plays a key role in this pathway and is associated with melanoma cell invasion and metastasis. Double-clicking on the nod of YAP1 gene will render its activity on the spatial plot.
The spatial plot reveals that YAP1 activity is elevated in Cluster 3.
Select specific spot or group of spots using the box or lasso selection tools to visalize mean activity values of slected pathway.
The selected spots’ mean activity is visualized on the pathway network.
This tab allows you to select a pathway for independent visualization. Selected pathways are color-coded based on the selected cluster or spots. You can choose between PSF activity or gene expression fold change as the mapping value for pathway nodes.
With these steps, you can explore and understand the spatial transcriptomic data comprehensively using the PSF Spatial Browser.
A: The app may disconnect due to inactivity or extended running time. If this happens, simply refresh the page to reconnect.
A: Errors may appear if unexpected inputs are provided or due to other issues. If the app disconnects, try refreshing. If errors persist, check the console log for specific messages and report them.
A: If you encounter any issues or improper functionality, report them on the GitHub repository here.
All the necessary codes for analyzing spatial transcriptomics data and running the Shiny application locally are available in the GitHub repository:
A related paper describing the PSF Spatial Browser and the analysis of the melanoma dataset has been submitted to a journal and will be available soon. Please check the GitHub repository for updates.
To get a better understanding of the PSF Spatial Browser’s functionality, watch the demo video:
The PSF Spatial Browser app was developed by Siras Hakobyan. If you have any questions or would like to get in touch, please use the contact details below:
Feel free to reach out regarding questions, suggestions, or issues related to the app. Your feedback is greatly appreciated!