Maintainer: Jianhai Zhang

1 Introduction

The spatialHeatmap package offers a generic and flexible environment for visualizing spatial bulk and single-cell assays in anatomical images. It colors spatial features (e.g. tissues) annotated in the images according to the quantitative abundance levels of measured biomolecules (e.g. mRNAs) using a color key. This core functionality of the package is called a spatial heatmap (SHM) plot. Single-cell data can be co-visualized in composite plots that combine SHMs with embedding plots of high-dimensional data. Additional important functionalities include the automated identification of biomolecules with spatially selective abundance patterns and clusters of biomolecules sharing similar abundance profiles.

To plot SHMs, a pair of assay data and anatomical image is required. The format of the latter should be annotated Scalable Vector Graphics (aSVG), where spatial features such as cells, tissues, and organs are annotated with unique identifiers. In addition to the public SVG repository EBI anatomogram, spatialHeatmap also supports custom aSVGs, which is one of the most important features. This tutorial explains how to create custom aSVGs for plotting SHMs. spatialHeatmap offers its own SVG repository (SHM SVG repo) for depositing aSVGs created using this tutorial (SHM SVGs). Furthermore, the Supplement provides information on converting SHM SVG format to EBI SVG format.

2 Getting Started

First, install the spatialHeatmap package from Bioconductor.

if (!requireNamespace("BiocManager", quietly = TRUE))

Next, the packages required for running the sample code in this tutorial need to be loaded.

library(spatialHeatmap); library(SummarizedExperiment); library(GEOquery)

The following lists the vignette(s) of spatialHeatmap in an HTML browser. Clicking the corresponding name will open this vignette.


3 Creating SVGs

This tutorial showcases the creation of custom aSVGs using the SVG editor Inkscape. Within Inkscape, there are three methods for generating spatial features: drawing with templates, employing geometric shapes, and utilizing GIMP.

3.1 Drawing with Templates

A template is a raster image that contains spatial features. An example template of Arabidopsis thaliana (Arabidopsis) root is provided here (Mustroph et al. 2009). Download this template and open it in Inkscape (Figure 1A). Select “Draw Bezier curves and straight lines (shift+F6)” on the left tool bar (Figure 1B).

Open the template in Inkscape.

Figure 1: Open the template in Inkscape

Select “Fill and Stroke…” under the “Object” tab on the top (Figure 2A). On the right panel “Fill and Stroke (Shift+Ctrl+F)”, set “Stroke style” 3.000 px (Figure 2B) and press “Enter” key.

Open the 'Fill and Stroke' panel.

Figure 2: Open the ‘Fill and Stroke’ panel

Press the “+” key to zoom in and select a template shape to start. Draw an outline for each shape by clicking at differencet corners of the shape (Figure 3A-B). At last, click at the start point to seal the outline (Figure 3C), then a spatial feature is created.