We’ve rebranded some of our products, learn more ›

CODEX® is now PhenoCycler,
Phenoptics™ is now Phenolmager.

Spatial Analysis with Seurat: Unlocking Single-Cell Insights from CODEX Data

Seurat is an R package developed by Rahul Satija’s lab at the New York Genome Center. A widely used, open-source tool for single-cell analysis, Seurat was designed to explore single-cell RNA sequencing data.

Seurat can also be applied to multiplex imaging-based spatial phenotyping data generated with CODEX®. Bioinformatics Field Application Scientist, Grady Carlson, PhD, shared the steps for using Seurat to analyze CODEX datasets and perform cellular neighborhood analysis in an on-demand Akoya Academy webinar. We’ll cover the key points from his talk in this post.

Visualizing CODEX spatial phenotyping data with MAV

The ability to detect multiple markers in single cells while preserving spatial context is a game-changer in biology. Tissues – the tumor microenvironment, in particular – are composed of a diverse group of cells, and it may require several markers to identify a single cell type. Studying cells in the context of tissue is essential, as spatial phenotypes and intercellular interactions can impact biological outcomes and single-cell resolution is needed to identify these cell-cell interactions and cellular neighborhoods.

The CODEX system uses an automated workflow to perform multiplex imaging of whole tissues at single-cell resolution. After tissue images are acquired through CODEX automation, cells are segmented to extract features from the images that aid in phenotyping cells with spatial context.

The Multiplex Analysis Viewer (MAV) is an ImageJ plugin that is part of the CODEX Software Suite. MAV enables visualization, annotation, and analysis of cell populations from CODEX imaging data. For each cell in the imaged tissue, MAV generates spatial coordinates and measures the integrated signal intensity for each antibody.

To demonstrate how we can pass this data into Seurat for clustering and downstream cellular neighborhood analysis, Grady used an example CODEX dataset from an experiment run on human FFPE tonsil tissue. Before importing the data into Seurat for further analysis, he visually assessed the quality of the imaging data within MAV.

mav staining visualization

DAPI nuclear stain, CD8, CD4, pancytokeratin, and CD20 visualized on FFPE human tonsil tissue in the CODEX MAV software.

“One of the ways we curate our data before exporting for clustering is to look for segmentation and make sure we don’t have any false segmentation in the imagery,” said Grady. Within MAV, it is possible to gate your cell population to exclude any false segmentation. Once you have selected your cell population, the data can then be exported to Seurat.

Clustering cell populations with Seurat

Using a set of pre-written scripts in R, Grady performed clustering of the CODEX data with Seurat. Seurat uses a series of calculations to scale the data to see differences in antigen expression on cells, perform uniform manifold approximation and projection (UMAP), and calculate cell clusters.

The resolution of the data determines how many clusters are output. The higher the resolution, the greater the number of clusters that Seurat will calculate. The final step is running UMAP, a dimension reduction technique for visualizing the clustered data. The clusters are then imported back into MAV.

Seurat also provides a few data visualization tools to analyze the clustered data. In the heatmap below, we can see all 18 of the clustered populations that Seurat generated from the tonsil tissue and their expression levels and frequency for each marker. The color of the lines corresponds to expression levels: bright yellow indicates high expression while purple indicates low expression. The number of lines denotes the frequency with which that marker is expressed in cells within a cluster.

seurat heatmap

Ridge plots show the level of expression of an individual marker across each cluster. In the ridge plot below generated from our CODEX dataset, we can see the expression intensity of CD8 across the 18 clusters. The clustered populations 0, 7, and 9 display the highest levels of CD8 expression, which is also visible in the heatmap.

seurat ridgeplot

Looking at UMAPs can also provide useful context for phenotyping cells. In the plots below, we can see CD4 is more highly expressed on the left side of the UMAP. Thus, we would expect clusters 3 and 4 to be CD4+ populations.

Phenotyping clustered populations in MAV

After importing the Seurat-generated clusters, Grady created another heatmap using MAV, which differs slightly from the Seurat heatmap. On the left, a dendrogram indicates the similarity of the different populations. The intensity of the target marker of each cluster is indicated by color – bright red means high intensity and white, low intensity.

mav heatmap seurat clusters 2

In the heatmap above, the dendrogram indicates that cluster 15 and 6 are very similar populations. They are both CD4+ cells, but cluster 15 has low expression of CD11c, while cluster 6 shows high expression. These clusters can be visualized directly on the tissue image in MAV.

Another way to explore the data involves generating a UMAP with MAV. Grady identified that the right side of the UMAP shows CD20 and Ki67 expression, suggesting that this part of the plot may correspond to germinal centers in the tissue. He confirmed this by gating on the population in MAV and mapping it back onto the tissue.

mav umap gating

Cluster 6 (green), cluster 15 (magenta) and germinal centers (orange) visualized on tonsil tissue.

Together, analysis tools in MAV and Seurat are useful for identifying phenotypes present in tissue. These phenotypes can be used in combination with cellular neighborhoods for further analysis.

Cellular neighborhoods reveal patterns of spatial proximity

Cellular neighborhoods are created by calculating “spatial windows”. These spatial windows are determined by the nearest neighbors of cells in tissue and by clustering them, we can find common patterns of proximity, or cellular neighborhoods.

Using algorithms published by Schurch, C. et al, Cell 2020, neighborhoods were calculated and are shown below as a heatmap, with the neighborhoods listed on the right and the phenotyped Seurat clusters on the bottom. “This is a high-resolution view of the spatial patterns inside the tissue,” said Grady. This type of analysis looks beyond pairwise analysis to study the combinations of cell interactions across tissue.

seurat cell neighborhoods heatmap

Cluster 6 (green), cluster 15 (magenta) and germinal centers (orange) visualized on tonsil tissue.

As demonstrated in the webinar, CODEX data is compatible with Seurat and other single-cell analysis tools for in-depth study of the spatial architecture of whole tissues. “The CODEX system enables quantification of spatial association on multiple scales by providing single-cell resolution to calculate cell neighborhoods and pairwise cell proximity,” noted Grady.


To learn more, watch the webinar on demand. The scripts and instructions for using CODEX with Seurat are also available online.

Subscribe to Our Blog for Updates

By signing up you are agreeing to our Privacy Policy.