CRAWDAD
enables the characterization of spatial cell-type relationships across different length scales.
CRAWDAD
is a statistical framework that uses cell-type labeled spatial omics data to identify the colocalization or separation of cell types at different length scales. CRAWDAD identifies the spatial relationship of cell types in the tissue and the length scale in which they reach significance. It identifies groups of cells with similar spatial relationships patterns. Also, CRAWDAD subsets the cell types based on their proximity to others. Lastly, CRAWDAD compares multiple tissue samples using their cell-type spatial relationship patterns. Therefore, CRAWDAD is a powerful tool for tissue characterization and comparison.
To install CRAWDAD
, we recommend using remotes
:
require(remotes)
remotes::install_github('JEFworks-Lab/CRAWDAD')
library(crawdad)
library(tidyverse)
## load the spleen data of the pkhl sample
data('pkhl')
## convert dataframe to spatial points (SP)
cells <- crawdad::toSF(pos = pkhl[,c("x", "y")], cellTypes = pkhl$celltypes)
## define the scales to analyze the data
scales <- c(100, 200, 300, 400, 500, 600, 700, 800, 900, 1000)
## shuffle cells to create null background
shuffle_list <- crawdad:::makeShuffledCells(cells,
scales = scales,
perms = 3,
ncores = 7,
seed = 1,
verbose = TRUE)
## calculate the zscore for the cell-type pairs at different scales
results <- crawdad::findTrends(cells,
neighDist = 50,
shuffleList = shuffle_list,
ncores = 7,
verbose = TRUE,
returnMeans = FALSE)
dat <- crawdad::meltResultsList(results, withPerms = TRUE)
## calculate the zscore for the multiple-test correction
zsig <- correctZBonferroni(dat)
## summary visualization
vizColocDotplot(dat, zSigThresh = zsig, zScoreLimit = 2*zsig,
dotSizes = c(3,15)) +
theme(axis.text.x = element_text(angle = 35, h = 0))
## visualize trend for one cell-type pair
dat %>%
mutate(id = 'pkhl') %>%
filter(reference == 'Podoplanin') %>%
filter(neighbor == 'CD4 Memory T cells') %>%
vizTrends(lines = TRUE, withPerms = TRUE, zSigThresh = zsig)
More details can be found in the tutorials.
CRAWDAD
applied to simulated dataCRAWDAD
applied to a mouse embryo seqfish dataCRAWDAD
applied to a mouse cerebellum slideseq dataCRAWDAD
applied to a human spleen codex data
CRAWDAD was tested on R version 4.3.0 (2023-04-21) -- "Already Tomorrow". Installation time is 1 minute in a Mac Pro Computer.