See the source code of this vignette for the script used to compute the Moran’s I values analyzed in 2. Tumor spatial autocorrelation and clinical prognosis.

Image loading and spatial processing

Download the mibiTOF data from the Angelo Lab website. Move the datasets into the data directory.

This portion of the script converts each image into a more analysis-friendly format, and computes Gabriel graphs/neighborhoods, which is used as the spatial weighting matrix (SWM) in the Moran’s I calculation below.

Some parts of this image processing steps of this script are adapted from code by Pratheepa Jeganathan and Kris Sankaran. Github: @PratheepaJ @krisrs1128

Computing Moran’s Index

This portion reads in the processed files generated above and computes Moran’s I for each variable, which includes attributes like protein expression values (Moran’s I is computed for each), cell type dummy variable, and cell size.

The output of this code is the resMoranTest.csv file included in the data folder.


  1. Harvard School of Public Health↩︎