3  Getting Started

If you are new to spatial omics data and would like to jump into some analysis, this page is a great place to start.

3.1 What technologies is our software applicable to?

Our suite of packages is geared towards analysing single-cell resolution assays, and the workflow described here focuses on single-cell resolution assays that have spatial context, i.e., each of the cells has an x-y coordinate. Technologies that generate this type of data include Imaging Mass Cytometry, MIBI-TOF, Xenium, CosMx, and MERFISH.

Please check out our scdney suite of packages for how to analyse many different types of single cell resolution assays.

3.2 Using our packages

It is important to know that our packages are interoperable with many other awesome packages out there. We highly recommend that you reflect on your needs or what you would like to find in your data, and then choose the analytical methods that will be most appropriate for your data.

To get started with our packages, we recommend that you read the descriptions of our packages on the Software page. Clicking on the beautiful hex stickers will take you to the package vignettes that will explain their functionality in depth.

We also recommend that you browse our analysis examples in the case studies chapter. Here, you will find the application of combinations of our packages to answer multi-component questions on a diverse range of spatially-resolved single-cell assays. While reading this, keep the specific assay in mind for context, but also recognize that most of the demonstrated analytical approaches can be applied to a wide range of assays.

3.3 SpatialExperiment

In keeping with interoperability, we use the SpatialExperiment object from the SpatialExperiment package as the central linking framework across many of the packages.

3.3.1 Creating a SpatialExperiment object

  • The vignette for the SpatialExperiment package explains how to turn a matrix or data.frame into a SpatialExperiment.

  • If you have a .csv file or a .xlsx file, this can be read into R using read_csv() and read_xlsx() from the readxl package and converted into a matrix or data.frame. You could also use read.csv() or read.delim() in base R.

  • If you have a Seurat object, you can convert this to a SingleCellExperiment using the as.SingleCellExperiment() function or back again using as.Seurat().

  • A SpatialExperiment object is very similar to a SingleCellExperiment but with spatial coordinates stored in the spatialCoords() slot. Many people analyse spatial data using a SingleCellExperiment object with the spatial coordinates stored in colData. Most of our packages are accepting of this approach.

  • For visualisations, we recommend duplicating your spatialCoords() in the reducedDim() slot and in the colData.

3.3.2 Installing packages

To get started with the workflow, you can install the following Bioconductor packages:

if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(version = "3.20")

# Bioconductor packages
BiocManager::install(c("SingleCellExperiment",
                       "SpatialExperiment",
                       "tidySingleCellExperiment",
                       "SpatialDatasets",
                       "cytomapper",
                       "EBImage",
                       "simpleSeg",
                       "scater",
                       "FuseSOM",
                       "STexampleData",
                       "scuttle",
                       "scClassify",
                       "spicyR",
                       "Statial",
                       "imcRtools",
                       "treekoR",
                       "lisaClust",
                       "ClassifyR"))


# other packages
install.packages(c("dplyr",
                   "ggplot2",
                   "MLmetrics",
                   "survival",
                   "tibble",
                   "ggsurvfit",
                   "ggpubr"))

We can now move on to the first stage of the spatial analysis pipeline.