1 Installation

if (!require("BiocManager"))
# load required packages

2 Overview

Clustering local indicators of spatial association (LISA) functions is a methodology for identifying consistent spatial organisation of multiple cell-types in an unsupervised way. This can be used to enable the characterization of interactions between multiple cell-types simultaneously and can complement traditional pairwise analysis. In our implementation our LISA curves are a localised summary of an L-function from a Poisson point process model. Our framework lisaClust can be used to provide a high-level summary of cell-type colocalization in high-parameter spatial cytometry data, facilitating the identification of distinct tissue compartments or identification of complex cellular microenvironments.

3 Quick start

3.1 Generate toy data

TO illustrate our lisaClust framework, here we consider a very simple toy example where two cell-types are completely separated spatially. We simulate data for two different images.

x <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3,
y <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3,
cellType <- factor(paste('c',rep(rep(c(1:2),rep(200,2)),4),sep = ''))
imageID <- rep(c('s1', 's2'),c(800,800))

cells <- data.frame(x, y, cellType, imageID)

ggplot(cells, aes(x,y, colour = cellType)) + geom_point() + facet_wrap(~imageID)

3.2 Create SegmentedCellExperiment object

First we store our datas into a SegmentedCells object.

cellExp <- SegmentedCells(cells, cellTypeString = 'cellType')

3.3 Generate LISA curves

We can then calculate local indicators of spatial association (LISA) functions using the lisa function. In our implementation, our LISA curves are a localised summary of an L-function from a Poisson point process model. By default, lisa will calculate curves for 20 ‘sensible’ radii for each cell-type.

lisaCurves <- lisa(cellExp)

3.4 Perform some clustering

The LISA curves can then be used to cluster the cells. Here we use k-means clustering, other clustering methods like SOM could be used. We can store these cell clusters or cell “regions” in our SegmentedCells object using the region() <- function.

kM <- kmeans(lisaCurves,2)
region(cellExp) <- paste('region',kM$cluster,sep = '_')

3.5 Plot identified regions

The hatchingPlot function can be used to construct a ggplot object where the regions are marked by different hatching patterns. This allows us to plot both regions and cell-types on the same visualization.

hatchingPlot(cellExp, imageID = c('s1','s2'))