Skip to main content

Spatial

This page covers spatial transcriptomics and imaging mass cytometry. Notes start from the files the instrument software writes, such as Visium, Xenium or CosMx output, and keep each spot or cell at its position in the tissue.

Prompts to try

  1. Find spatial domains in a human DLPFC Visium section. Send:

    Load Visium_humanDLPFC from STexampleData and keep the spots on the tissue.

    Then:

    Preprocess the data for BayesSpace with 15 principal components.

    Then:

    Cluster the spots into seven domains with nrep 1000 and a burn-in of 100, and set a seed.
  2. Cell types or tissue domains with BANKSY. Send:

    Load the hippocampus VeraFISH data that comes with Banksy and put it in a SpatialExperiment.

    Then:

    What does BANKSY's lambda parameter control?
  3. Build a neighbourhood graph for tumour imaging mass cytometry data. Send:

    Load the single-cell object from IMMUcan_2022_CancerExample in imcdatasets. Which columns hold the image, the cell type and the coordinates?

    Then:

    Build a k-nearest-neighbour spatial graph within each image, using cell_x and cell_y as coordinates.
  4. Read raw Xenium output. The XeniumOutput example in SFEData is a small set of raw output files from a 10x Xenium run:

    Download the XeniumOutput example from SFEData.

What a note can do

Notes hold the data in a SpatialExperiment or SpatialFeatureExperiment, which keep the counts together with positions, images and cell outlines, and draw it on the tissue with ggspavis. They follow the OSTA book and the tidy spatial workshop.

  • Many platforms. Notes work with Visium, Slide-seq, the original Spatial Transcriptomics array, seqFISH, MERFISH and MERSCOPE, CosMx, Xenium, STARmap PLUS and imaging mass cytometry, and read raw Xenium and CosMx output into R.
  • Quality control. Notes flag low-quality spots or cells, and SpotSweeper finds local outliers and tissue damage.
  • Spatially variable genes. nnSVG finds genes whose level follows a pattern across the tissue.
  • Tissue regions. BayesSpace and BANKSY group spots or cells into regions, using their neighbours as well as their genes.
  • Patterns in space. Voyager and spdep compute measures such as Moran’s I and Getis-Ord to show where a gene or score clusters.
  • Neighbours. hoodscanR, imcRtools and spicyR test which cell types sit together more often than by chance.
  • Mixtures. SPOTlight and spacexr estimate which cell types make up each spot.

Reports on Roihu lists the CSC tools for work on sequencing reads.

Example notes

BayesSpace domains next to the manual layers in the 'Spatial domains with BayesSpace' note.