| blisa | R Documentation |
Generic function for running BLISA (Bivariate Local Indicator of Spatial
Association). Dispatches on the class of x:
blisa.default accepts a pre-binned gene-by-bin count
matrix and a matching bins polygon object.
blisa.SpatialExperiment accepts a cell-level
SpatialExperiment object and bins cells into hexagonal tiles
internally via hexBinCells before running the analysis.
blisa(x, ...)
## Default S3 method:
blisa(
x,
bins,
LR_df = NULL,
bin_size = 50,
dmax = 250,
nsim = 999,
p_cutoff = 0.05,
min_ligand = 10,
min_receptor = 10,
min_cells = 1,
n_cells_col = NA,
annotation_col = "annotation",
default_mode = "diffuse",
diffuse_category = c("Secreted Signaling", "Non-protein Signaling"),
species = c("human", "mouse"),
genes = NULL,
counts_by_group = NULL,
fast = TRUE,
cpu_threads = 4L,
verbose = FALSE,
...
)
## S3 method for class 'SpatialExperiment'
blisa(
x,
bin_size = 50,
LR_df = NULL,
group = "cell_type",
genes = NULL,
min_cells = 1,
min_total_counts = 10,
platform = c("auto", "xenium", "visium"),
verbose = FALSE,
...
)
x |
A gene-by-bin count matrix (for |
... |
Additional arguments passed to the relevant method. |
bins |
An |
LR_df |
Data frame of ligand-receptor pairs with columns
|
bin_size |
Numeric. Width of each hexagonal bin in coordinate units
(e.g. microns). Passed to |
dmax |
Numeric. Maximum distance for diffuse-mode neighbours.
Default |
nsim |
Integer. Number of permutations for Moran's I significance.
Default |
p_cutoff |
Numeric. P-value threshold for High-High hotspots.
Default |
min_ligand |
Numeric. Minimum ligand count threshold. Default |
min_receptor |
Numeric. Minimum receptor count threshold.
Default |
min_cells |
Integer. Minimum number of cells per bin. For a
|
n_cells_col |
Character or |
annotation_col |
Character. Column in |
default_mode |
Character. CCC mode assigned to LR pairs whose
annotation does not match |
diffuse_category |
Character vector of annotation categories treated as diffuse signalling. |
species |
Character. Which CellChatDB to download when
|
genes |
Character vector of gene names to consider when matching
ligand-receptor pairs. Defaults to |
counts_by_group |
Named list of gene-by-bin count matrices, one per
group level (e.g. cell type), as returned by |
fast |
Logical. When |
cpu_threads |
Integer. Number of OpenMP threads used by
|
verbose |
Logical. If |
group |
Character. Column name in |
min_total_counts |
Numeric. Bins whose total counts (summed over all
genes) fall below this threshold are dropped during binning by
|
platform |
Character. |
A list; see individual method documentation for details.
An object of class blisa with four components:
Data frame of BLISA results for each LR pair, including
ccc_mode, sig_numbers, sig_index, sig_pval,
all_pval, all_lisa, all_quadrant, and original
columns from LR_df. all_quadrant is a character vector of
hotspot quadrant labels ("High-High", "Low-Low", etc.)
for every bin; non-tested bins are NA.
Bin-level sf object of hexagonal polygons.
Spatial weights list from computeSpatialWeights.
NULL unless counts_by_group is supplied,
in which case a wide data frame of interaction scores from
runCCI: rows are "Sender->Receiver" group pairs,
columns are LR pairs.
blisa(default): Method for a gene-by-bin count matrix.
blisa(SpatialExperiment): Method for a cell-level SpatialExperiment object.
For cell-level platforms (e.g. Xenium) it bins cells into hexagonal tiles
via hexBinCells; for Visium it treats each spot as a bin via
visiumSpotBins. Either way it then delegates to
blisa.default. The path is chosen by platform.
## Not run:
# Download and cache the example Xenium breast cancer dataset (~21 MB)
data_url <- paste0(
"https://github.com/ChenLaboratory/example_data/releases/",
"download/v1.0.0/spe_xenium_bc_s1rep1.rds"
)
cache_dir <- tools::R_user_dir("blisa", "cache")
data_file <- file.path(cache_dir, "spe_xenium_bc_s1rep1.rds")
if (!file.exists(data_file)) {
dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE)
download.file(data_url, data_file, mode = "wb")
}
spe <- readRDS(data_file)
# blisa.SpatialExperiment method: bins cells, runs LISA, scores CCI
result <- blisa(spe, bin_size = 50, group = "cell_type")
result
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.