CRAWDAD

Cell Relationship Analysis Workflow Done Across Distances

View the Project on GitHub JEFworks-Lab/CRAWDAD

Cell-type Relationship Analysis Workflow Done Across Distances (CRAWDAD)

CRAWDAD enables the characterization of cell-type relationships across different scales.

Overview

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.

Installation

To install CRAWDAD, we recommend using remotes:

require(remotes)
remotes::install_github('JEFworks-Lab/CRAWDAD')

Example

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.

Tutorials

Contributing

We welcome any bug reports, enhancement requests, general questions, and other contributions. To submit a bug report or enhancement request, please use the CRAWDAD GitHub issues tracker. For more substantial contributions, please fork this repo, push your changes to your fork, and submit a pull request with a good commit message.