The goal of spatialCCC package is to investigate cell-cell signaling, by analyzing ligand-receptor interactions in spatial transcriptomic data.
You can install the development version of spatialCCC from GitHub with:
# install.packages("devtools")
devtools::install_github("dolchan/spatialCCC")
This is a basic example which shows you a basic workflow of the package:
- First, load required R packages.
library(spatialCCC)
- Then, load built-in LR database.
set.seed(100)
LRdb_m <-
get_LRdb("mouse", n_samples = 100)
- Load an example Visium spatial transcriptomic data
data_dir <- file.path("example", "visium_tutorial")
spe_brain <-
SpatialExperiment::read10xVisium(samples = data_dir,
type = "HDF5",
data = "filtered")
# Log-Normalize
spe_brain <- scater::logNormCounts(spe_brain)
- Compute Cell-Cell Communications over ligand-receptor pairs
ccc_graph_list <-
compute_spatial_ccc_graph_list(spe = spe_brain,
assay_name = "logcounts",
LRdb = LRdb_m,
workers = 6)
- Spatial CCC graph plot with tissue image
LR_of_interest <- "Pdgfb_Pdgfra"
plot_spatial_ccc_graph(
ccc_graph = ccc_graph_list[[LR_of_interest]],
tissue_img = SpatialExperiment::imgRaster(spe_brain),
node_color = "group",
node_size = 1,
node_alpha = 0.5,
edge_color = "group",
# clip = TRUE,
which_on_top = "edge"
)
- Spatial CCC graph plot without tissue image
In this case, graph layout can be “spatial” which keeps the original spatial locations, or other graph layout algorithm supported by igraph package.
plot_spatial_ccc_graph(
ccc_graph = ccc_graph_list[[LR_of_interest]],
graph_layout = "spatial",
node_color = "group",
node_size = 1,
edge_color = "group_diameter",
clip = TRUE,
which_on_top = "edge"
)
- Spatial CCC graph plot with “auto”, a.k.a., “kk” spring layout
In this format and the one below, one can see the distribution of cell-cell communication clusters
plot_spatial_ccc_graph(
ccc_graph = ccc_graph_list[[LR_of_interest]],
node_color = "group",
node_size = 0.1,
edge_color = "group_diameter",
edge_width = 0.1,
which_on_top = "edge"
)
- Spatial CCC graph plot with “stress” layout
plot_spatial_ccc_graph(
ccc_graph = ccc_graph_list[[LR_of_interest]],
# tissue_img = SpatialExperiment::imgRaster(spe_brain),
graph_layout = "stress",
node_color = "group",
edge_color = "group_diameter",
edge_width = 0.25,
which_on_top = "edge"
)