| Type: | Package |
| Title: | Infer Cell-Cell Communication from Spatial Transcriptomics |
| Version: | 0.2.0 |
| Description: | Identifies cell-cell communication hotspots in spatial transcriptomics data using bivariate Local Moran's I statistics on hexagonally binned cells. Provides functions for spatial weighting, ligand-receptor pair filtering, hotspot detection, and visualisation of sender-receiver cell-type interactions. |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| Imports: | sf, spdep, Matrix, SpatialExperiment, SummarizedExperiment, ComplexHeatmap, ggplot2, viridisLite, grid |
| RoxygenNote: | 7.3.3 |
| VignetteBuilder: | knitr |
| Suggests: | knitr, rmarkdown |
| NeedsCompilation: | no |
| Packaged: | 2026-05-29 02:55:39 UTC; yuchen |
| Author: | Yunshun Chen [aut, cre], Lei Qin [aut], Lizhong Chen [aut] |
| Maintainer: | Yunshun Chen <yuchen@wehi.edu.au> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-02 07:50:36 UTC |
blisa: Bivariate Local Indicator of Spatial Association for spatial transcriptomics
Description
Tools for spatial cell-cell communication analysis of spatial transcriptomics data.
Run BLISA spatial cell-cell communication analysis
Description
Generic function for running BLISA (Bivariate Local Indicator of Spatial
Association). Dispatches on the class of x:
-
blisa.defaultaccepts a pre-binned gene-by-bin count matrix and a matchingbinspolygon object. -
blisa.SpatialExperimentaccepts a cell-levelSpatialExperimentobject and bins cells into hexagonal tiles internally viahexBinCellsbefore running the analysis.
Usage
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,
...
)
## S3 method for class 'SpatialExperiment'
blisa(x, bin_size = 50, LR_df = NULL, group = "cell_type", genes = NULL, ...)
Arguments
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. Bins with fewer cells are excluded from
Moran's I and assigned neutral statistics (p = 1, LISA = 0).
Ignored when |
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 |
group |
Character. Column name in |
Value
A list; see individual method documentation for details.
An object of class blisa with four components:
- LR_results
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 fromLR_df.all_quadrantis a character vector ofspdep::hotspotquadrant labels ("High-High","Low-Low", etc.) for every bin; non-tested bins areNA.- bins
Bin-level
sfobject of hexagonal polygons.- spatial_weights
Spatial weights list from
computeSpatialWeights.- CCI_scores
NULLunlesscounts_by_groupis supplied, in which case a wide data frame of interaction scores fromrunCCI: rows are"Sender->Receiver"group pairs, columns are LR pairs.
Methods (by class)
-
blisa(default): Method for a gene-by-bin count matrix. -
blisa(SpatialExperiment): Method for a cell-level SpatialExperiment object. Bins cells into hexagonal tiles viahexBinCellsthen delegates toblisa.default.
Compute Spatial Weights for BLISA
Description
Builds queen (nearby) and distance-decay (diffuse) spatial weight matrices
from a bin-level sf object, excluding isolated bins and optionally
excluding low-cell bins. A second-pass isolation check further removes bins
that become isolated after the initial subset.
Usage
computeSpatialWeights(
bins,
bin_size = 50,
dmax = 250,
min_cells = 1,
n_cells_col = NA
)
Arguments
bins |
An |
bin_size |
Numeric. Bin spacing used to define queen adjacency
( |
dmax |
Numeric. Maximum distance for diffuse-mode neighbours. |
min_cells |
Integer. Minimum cell count for a bin to be
included. Ignored when |
n_cells_col |
Character or |
Value
A list with:
- queen_wt
Spatial weights list for nearby (queen) mode.
- dist_wt
Spatial weights list for diffuse (distance-decay) mode.
- keep_idx_queen
Integer indices of bins used in queen-mode Moran.
- keep_idx_dist
Integer indices of bins used in diffuse-mode Moran.
- isolate_idx_queen
Integer indices of original queen-mode isolates.
- isolate_idx_dist
Integer indices of original diffuse-mode isolates.
- low_cell_idx
Integer indices of bins excluded for low cell counts.
- queen_nb_full
Full (unsubset) neighbour list for nearby mode, indexed over all bins.
- dist_nb_full
Full (unsubset) neighbour list for diffuse mode, indexed over all bins.
Filter ligand-receptor pairs by expression threshold
Description
Retains only LR pairs where at least one bin/spot has counts at or above
min_ligand for every ligand subunit and min_receptor for every
receptor subunit.
Usage
filterLRpairs(
counts,
min_ligand = 10,
min_receptor = 10,
LR_df = NULL,
species = c("human", "mouse")
)
Arguments
counts |
Gene-by-bin count matrix (dense or sparse). Row names must be gene symbols. |
min_ligand |
Numeric. Minimum count threshold for ligand genes. At least one bin must meet or exceed this value. Default 10. |
min_receptor |
Numeric. Minimum count threshold for receptor genes. At least one bin must meet or exceed this value. Default 10. |
LR_df |
Data frame of ligand-receptor pairs with columns
|
species |
Character. Which CellChatDB to download when |
Value
A subset of LR_df containing only pairs that pass the
expression thresholds for both ligand and receptor.
Bin cells into hexagonal spatial bins
Description
Aggregates single-cell spatial data into hexagonal bins and returns a
bin-level count matrix together with a matching sf polygon object,
ready to pass directly to blisa.default.
Usage
hexBinCells(
coords_df,
counts_matrix,
bin_size = 50,
min_cells = 1,
group = NULL
)
Arguments
coords_df |
Data frame or matrix with columns |
counts_matrix |
Gene-by-cell count matrix (dense or sparse). Row names
must be gene symbols; column names must be cell IDs present in
|
bin_size |
Numeric. Approximate width of each hexagonal bin in
coordinate units (e.g. microns). Analogous to |
min_cells |
Integer. Bins containing fewer than |
group |
Factor or character vector of length |
Value
A list with:
- counts_matrix
Gene-by-bin sparse count matrix (all cells combined). Column i corresponds to row i of
bins.- bins
An
sfobject of hexagonal bin polygons with ann_cellscolumn recording how many cells fall in each bin. Row order matches the columns ofcounts_matrix.- counts_by_group
(Only when
groupis supplied.) A named list of gene-by-bin sparse matrices, one per cell-type level, with the same bin order ascounts_matrix.
Test if an object is a blisa object
Description
Test if an object is a blisa object
Usage
is.blisa(x)
Arguments
x |
Any R object. |
Value
Logical.
Create a blisa object
Description
Constructor for the blisa S3 class, which stores the full output of
blisa.
Usage
new_blisa(LR_results, bins, spatial_weights, CCI_scores = NULL)
Arguments
LR_results |
Data frame of BLISA results, one row per ligand-receptor pair. |
bins |
An |
spatial_weights |
Spatial weights list from
|
CCI_scores |
Wide data frame of cell-cell interaction scores from
|
Value
An object of class blisa.
Heatmap of CCI scores across all ligand-receptor pairs
Description
Generic function. Draws a clustered heatmap (via ComplexHeatmap)
with rows as Sender \rightarrow Receiver cell-type pairs and columns
as LR pairs. Row annotations colour-code the sender and receiver cell types.
Usage
plotCCI(x, ...)
## S3 method for class 'blisa'
plotCCI(
x,
top_lr = 20,
top_pairs = 30,
sender = NULL,
receiver = NULL,
colors = NULL,
colours = NULL,
...
)
## Default S3 method:
plotCCI(
x,
top_lr = 20,
top_pairs = 30,
sender = NULL,
receiver = NULL,
colors = NULL,
colours = NULL,
...
)
Arguments
x |
A |
... |
Additional arguments passed to the relevant method. |
top_lr |
Integer or |
top_pairs |
Integer or |
sender |
Character vector or |
receiver |
Character vector or |
colors |
Named character vector mapping cell-type names to colours,
used for the sender/receiver row annotations. When |
colours |
Alias for |
Value
Invisibly returns the Heatmap object.
Methods (by class)
-
plotCCI(blisa): Method for ablisaobject. ExtractsCCI_scoresand delegates toplotCCI.default. Stops with an informative error ifCCI_scoresisNULL. -
plotCCI(default): Method for a CCI scores data frame (e.g. theCCI_scoresslot of ablisaobject).
See Also
plotCCILR for a sender-by-receiver heatmap of a
single LR pair; plotCCIsummary for an aggregated
sender-by-receiver heatmap across all LR pairs.
Sender-by-receiver heatmap of CCI scores for one ligand-receptor pair
Description
Generic function. Reshapes the CCI data frame into a receiver-by-sender cell-type matrix for one selected LR pair and draws a clustered heatmap.
Usage
plotCCILR(x, ...)
## S3 method for class 'blisa'
plotCCILR(x, index = 1, ligand = NULL, receptor = NULL, ...)
## Default S3 method:
plotCCILR(x, lr_pair, ...)
Arguments
x |
A |
... |
Additional arguments passed to the relevant method. |
index |
Integer. Row index into |
ligand |
Character. Ligand gene symbol. When both |
receptor |
Character. Receptor gene symbol. Must be supplied together
with |
lr_pair |
Character. Column name in the CCI scores data frame
corresponding to the ligand-receptor pair to visualise
(e.g. |
Value
A Heatmap object.
Methods (by class)
-
plotCCILR(blisa): Method for ablisaobject. The LR pair is selected byindex(default 1, the top-ranked pair) unless bothligandandreceptorare supplied, in which case the matching row is located automatically andindexis ignored. Stops with an informative error ifCCI_scoresisNULLor the selected LR pair has no significant hotspots. -
plotCCILR(default): Method for a CCI scores data frame (e.g. theCCI_scoresslot of ablisaobject). The LR pair is selected by column name vialr_pair.
See Also
plotCCI for an overview heatmap across all LR pairs;
plotCCIsummary for an aggregated sender-by-receiver heatmap.
Spatial map of dominant sender-receiver cell-type pairs at BLISA hotspots
Description
For a selected ligand-receptor pair, identifies the dominant interacting cell-type pair at each significant hotspot bin and draws a spatial map of the tissue coloured by those pairs. Receiver cells are those inside hotspot bins; sender cells are drawn from the immediate neighbourhood.
Usage
plotCCIspatial(
x,
counts_by_group,
index = 1,
ligand = NULL,
receptor = NULL,
top_pairs = 30
)
Arguments
x |
A |
counts_by_group |
Named list of gene-by-bin count matrices, one per
cell type. Typically the |
index |
Integer. Row index into |
ligand |
Character. Ligand gene symbol. When both |
receptor |
Character. Receptor gene symbol. Must be supplied together
with |
top_pairs |
Integer. Maximum number of distinct cell-type pairs to show
in the legend; remaining pairs are grouped as |
Value
A ggplot object.
See Also
plotHotspots for a significance-based spatial map of
hotspot bins.
Sender-by-receiver heatmap of aggregated CCI scores across LR pairs
Description
Generic function. Aggregates CCI scores across all (or the top-ranked)
ligand-receptor pairs and draws a clustered receiver-by-sender heatmap, one
cell per Sender \rightarrow Receiver combination.
Usage
plotCCIsummary(x, ...)
## S3 method for class 'blisa'
plotCCIsummary(
x,
top_lr = NULL,
sender = NULL,
receiver = NULL,
agg_fun = sum,
...
)
## Default S3 method:
plotCCIsummary(
x,
top_lr = NULL,
sender = NULL,
receiver = NULL,
agg_fun = sum,
...
)
Arguments
x |
A |
... |
Additional arguments passed to the relevant method. |
top_lr |
Integer or |
sender |
Character vector or |
receiver |
Character vector or |
agg_fun |
Function used to aggregate scores across LR pairs for each
Sender |
Value
A Heatmap object.
Methods (by class)
-
plotCCIsummary(blisa): Method for ablisaobject. Stops with an informative error ifCCI_scoresisNULL. -
plotCCIsummary(default): Method for a CCI scores data frame (e.g. theCCI_scoresslot of ablisaobject).
See Also
plotCCILR for a per-LR-pair version of this plot;
plotCCI for a heatmap with LR pairs as columns.
Spatial hotspot map for one ligand-receptor pair
Description
Generic function. Plots each bin coloured by significance status: empty, non-significant, or significant hotspot (continuous gradient of -log10 p-value or 1 - p-value).
Usage
plotHotspots(x, ...)
## S3 method for class 'blisa'
plotHotspots(
x,
index = 1,
ligand = NULL,
receptor = NULL,
log_pval = TRUE,
p_cutoff = NULL,
...
)
Arguments
x |
A |
... |
Additional arguments passed to the method. |
index |
Integer. Row index into |
ligand |
Character. Ligand gene symbol. When both |
receptor |
Character. Receptor gene symbol. Must be supplied together
with |
log_pval |
Logical. If |
p_cutoff |
Numeric or |
Value
A ggplot object.
Methods (by class)
-
plotHotspots(blisa): Method for ablisaobject.
Dot plot ranking LR pairs by number of significant hotspot bins
Description
Generic function for ranking LR pairs. Dispatches on the class of x:
-
plotLRrank.blisaaccepts ablisaobject and uses itsLR_resultsslot directly. -
plotLRrank.data.frameaccepts theLR_resultsdata frame directly.
Usage
plotLRrank(x, ...)
## S3 method for class 'blisa'
plotLRrank(x, top = 30, pt_size = 4, flip = FALSE, ...)
## S3 method for class 'data.frame'
plotLRrank(x, top = 30, pt_size = 4, flip = FALSE, ...)
Arguments
x |
A |
... |
Additional arguments passed to the relevant method. |
top |
Integer or |
pt_size |
Numeric. Point size passed to |
flip |
Logical. When |
Value
A ggplot object.
Methods (by class)
-
plotLRrank(blisa): Method for ablisaobject. ExtractsLR_resultsand delegates toplotLRrank.data.frame. -
plotLRrank(data.frame): Method for a data frame of LR results (e.g. theLR_resultsslot of ablisaobject).
Score cell-cell interactions from BLISA hotspots
Description
Generic function for scoring cell-cell interactions. Dispatches on the
class of x:
-
runCCI.blisaaccepts ablisaobject. IfCCI_scoresare already present andoverwrite = FALSE(the default), the object is returned unchanged. Setoverwrite = TRUEwith acounts_by_groupto recompute and replace existing scores. If no scores exist,counts_by_groupmust be supplied and scores are computed and attached. -
runCCI.defaultperforms the raw computation given ablisaobject and acounts_by_grouplist, returning only the scores data frame. Used internally byrunCCI.blisaandblisa.default.
Usage
runCCI(x, ...)
## S3 method for class 'blisa'
runCCI(x, counts_by_group = NULL, overwrite = FALSE, ...)
## Default S3 method:
runCCI(x, counts_by_group, ...)
Arguments
x |
A |
... |
Additional arguments passed to the relevant method. |
counts_by_group |
Named list of gene-by-bin sparse count matrices, one
per group level (e.g. cell type). Typically the |
overwrite |
Logical. If |
Value
See individual method documentation.
runCCI.blisa: the input blisa object with
CCI_scores populated (a wide data frame – rows are
"Sender->Receiver" group pairs, columns are LR pairs).
runCCI.default: a data frame with "Sender->Receiver"
row names and one column per significant LR pair containing the
interaction score 0.5 * log2(receiver * sender + 1).
Methods (by class)
-
runCCI(blisa): Method for ablisaobject. IfCCI_scoresare already present andoverwrite = FALSE(the default), the object is returned unchanged. Setoverwrite = TRUEwith acounts_by_groupto recompute and replace existing scores. If no scores exist,counts_by_groupmust be supplied and scores are computed and attached tox$CCI_scores. -
runCCI(default): Default method. Performs the raw CCI computation and returns only the scores data frame. Typically called internally; userunCCI.blisato compute and attach scores to ablisaobject in one step.