Calculate the shortest distance between cells belonging to two different groups, and visualize distance measures of the first cell type

fireflyPlot(
  data = NULL,
  label = NULL,
  ct1 = NULL,
  ct1.lwd = 0,
  ct2 = NULL,
  ct2.lwd = 0,
  fovs = NULL,
  ct1.colthresh = 0.99
)

Arguments

data

a Seurat object containing Kandinsky data (`KanData()`)

label

character string specifying the variable name to be used to defne cell annotation groups

ct1

cell type A label

ct1.lwd

linewidth to use in plot for cell type A boundaries

ct2

cell type B label

ct2.lwd

linewidth to use in plot for cell type B boundaries

fovs

list of fov IDs to include in the analysis. If NULL, all fovs will be considered for the analysis

ct1.colthresh

quantile threshold to apply to the distance colorscheme for cells belonging to cell type A in the spatial plot. For instance, if `ct1.coltresh = 0.99`, any distance greater than the 99 percentile will not result in a lighter or darker cell color

Value

a list object containing the data frame with the distance measurement plus a spatial plot reporting cells A colored according to their distance from cells B

Details

For two groups A and B of cells of interest, this function will calculate the minimum distance from each cell of type A to cells of type B. Find the closest cell of type B for each cell of type A, then plot the corresponding euclidean distance as spatial heatmap of cells (type A/B) with the color scale based on the euclidean distance of cells A to the closest cell B, and with cells of type B colored in white to resemble a 'firefly' effect