Skip to content

JEFworks-Lab/CRAWDAD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cell-type Relationship Analysis Workflow Done Across Distances

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

Overview

CRAWDAD is a statistical framework that uses labeled spatial omics data to identify the colocalization or separation of cell types at different scales. CRAWDAD identifies regions where multiple cells colocalize, the scale of such colocalization, and also subsets the cell types based on their proximity to others. 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,
                               dist = 50,
                               shuffle.list = 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) +
  theme(axis.text.x = element_text(angle = 35, h = 0))

## visualize trend for one cell-type pair
dat %>% 
  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

Instalation

CRAWDAD was tested on R version 4.3.0 (2023-04-21) -- "Already Tomorrow". Installation time is 1 minute in a Mac Pro Computer.

Releases

No releases published

Packages

No packages published

Languages