One of the goals of spatialLIBD is to provide options for visualizing Visium data by 10x Genomics. In particular, vis_gene() and vis_clus() allow plotting of individual continuous or discrete quantities belonging to each Visium spot, in a spatially accurate manner and optionally atop histology images.

This vignette explores a more complex capability of vis_gene(): to visualize a summary metric of several continuous variables simultaneously. We’ll start with a basic one-gene use case for vis_gene() before moving to more advanced cases.

First, let’s load some example data for us to work on. This data is a subset from a recent publication with Visium data from the dorsolateral prefrontal cortex (DLPFC) (Huuki-Myers, Spangler, Eagles, Montgomergy, Kwon, Guo, Grant-Peters, Divecha, Tippani, Sriworarat, Nguyen, Ravichandran, Tran, Seyedian, Consortium, Hyde, Kleinman, Battle, Page, Ryten, Hicks, Martinowich, Collado-Torres, and Maynard, 2024).

library("spatialLIBD")
spe <- fetch_data(type = "spatialDLPFC_Visium_example_subset")
spe
#> class: SpatialExperiment 
#> dim: 28916 12107 
#> metadata(1): BayesSpace.data
#> assays(2): counts logcounts
#> rownames(28916): ENSG00000243485 ENSG00000238009 ... ENSG00000278817 ENSG00000277196
#> rowData names(7): source type ... gene_type gene_search
#> colnames(12107): AAACAAGTATCTCCCA-1 AAACACCAATAACTGC-1 ... TTGTTTGTATTACACG-1 TTGTTTGTGTAAATTC-1
#> colData names(155): age array_col ... VistoSeg_proportion wrinkle_type
#> reducedDimNames(8): 10x_pca 10x_tsne ... HARMONY UMAP.HARMONY
#> mainExpName: NULL
#> altExpNames(0):
#> spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres
#> imgData names(4): sample_id image_id data scaleFactor

Next, let’s define several genes known to be markers for white matter (Tran, Maynard, Spangler et al., 2021).

white_matter_genes <- c("GFAP", "AQP4", "MBP", "PLP1")
white_matter_genes <- rowData(spe)$gene_search[
    rowData(spe)$gene_name %in% white_matter_genes
]

## Our list of white matter genes
white_matter_genes
#> [1] "GFAP; ENSG00000131095" "AQP4; ENSG00000171885" "MBP; ENSG00000197971"  "PLP1; ENSG00000123560"

1 Plotting One Gene

A typical use of vis_gene() involves plotting the spatial distribution of a single gene or continuous variable of interest. For example, let’s plot just the expression of GFAP.

vis_gene(
    spe,
    geneid = white_matter_genes[1],
    point_size = 1.5
)