Welcome to the PSF Spatial Browser App

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.

  1. Hakobyan S, Stepanyan A, Nersisyan L, Binder H, Arakelyan A. PSF toolkit: an R package for pathway curation and topology-aware analysis. Front Genet. 2023 Aug 23;14:1264656. doi: 10.3389/fgene.2023.1264656.
  2. Nersisyan, L.; Johnson, G.; Riel-Mehan, M.; Pico, A.R.; Arakelyan, A. PSFC: A Pathway Signal Flow Calculator App for Cytoscape. F1000Research 2017, 4, 480, doi:10.12688/f1000research.6706.2.

User Interface Guide

The user interface consists of two main sections: the side panel with widgets and the main panel with interactive plots.

Side Panel

  • Select Cluster Widget: Allows you to select a desired cluster generated by the Seurat pipeline. Once a cluster is selected, the corresponding spots are highlighted on the spatial plot atop the tissue slice.
  • Top Features Tab: After selecting a cluster, the “Features to Visualize” selector is updated, displaying cluster-associated significant features in ascending order of adjusted p-value (FDR). Selecting a feature colorcodes the spots on the spatial plot based on their PSF activity value, and renders the pathway network beneath the spatial plot.
  • Pathway Vis Tab: This tab allows users to select a desired pathway for visualization. You can also select visualization values (either expression or PSF) for the pathway nodes.

Main Panel

The main panel contains the interactive spatial plot and pathway networks:

  • Interactive Spatial Plot: This plot can display spot clustering, colorcoded gene expression or pathway activities on top of tissue scan slice. You can zoom in, zoom out, and pan across the plot. Spots can be selected via box or lasso selection to explore expression or PSF values of specific areas of interest.
    • Spot Information on Hover: Hovering over a spot provides additional information about the cluster assignment or spot value.
  • Pathway Network Visualization: The selected pathway can be visualized in two different modes: KEGG or VisNet.
    • KEGG Visualization Mode: The KEGG pathway is displayed as an interactive image. Hovering over pathway nodes provides additional information, such as gene symbol, Entrez ID, expression values, and PSF activity.
    • VisNet Visualization Mode: VisNet utilizes visNetwork R package to render the pathway networks in an interactive format. This mode also supports zoom, and pan features.
    • Double-clicking a node (in KEGG) or single-clicking a node (in VisNet) highlights the node and visualizes its expression or activity value on the spatial plot.

The interactive interface is designed to make spatial transcriptomic exploration and analysis intuitive and informative.

Use Case: Exploring Spatial Transcriptomics in Human Melanoma

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.

Step 1: Data Preparation

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")

Step 2: Load and Prepare the Dataset

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")

Downloading Gene Symbol to Entrez ID Conversion Data

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"))

Step 3: Run Pathway Analysis

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)

Step 4: Launch the App

Launch the PSF Spatial Browser application:

run_psf_spatial_browser(psf_saptial_results = psf_spatial)

Step 5: Explore the Results

Once the app launches, you can begin exploring the analysis results interactively.

Selecting cluster of interest

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.

Cluster Selection Screenshot

Visualizing cluster specific features

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.

Feature Selection Screenshot

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.

Pathway Network Screenshot

Pathway node selection

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.

YAP1 Visualization Screenshot

The spatial plot reveals that YAP1 activity is elevated in Cluster 3.

Spot Selection for Averaged Pathway Activity

Select specific spot or group of spots using the box or lasso selection tools to visalize mean activity values of slected pathway.

Spot Selection Widgets Screenshot

Selected Spots Visualization Screenshot

The selected spots’ mean activity is visualized on the pathway network.

Pathway Visualization Tab

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.

FAQ & Troubleshooting

Q: Why does the app sometimes disconnect?

A: The app may disconnect due to inactivity or extended running time. If this happens, simply refresh the page to reconnect.

Q: What should I do if the app throws an error?

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.

Q: Where can I get help?

A: If you encounter any issues or improper functionality, report them on the GitHub repository here.

Resources

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:

Contact

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!