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, weighted = TRUE, ...)
# Default S3 method
runCCI(x, counts_by_group, weighted = TRUE, ...)Arguments
- x
A
blisaobject.- ...
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
counts_by_groupelement of the list returned byhexBinCellswhengroupis supplied. Names must match the group levels. Required whenx$CCI_scoresisNULLor whenoverwrite = TRUE.- overwrite
Logical. If
FALSE(default) andx$CCI_scoresis already populated, the object is returned unchanged. IfTRUEandcounts_by_groupis supplied, existing scores are recomputed and replaced.- weighted
Logical. If
TRUE(default), the ligand count of each sender group is the sum over hotspots \(h\) of its spatially weighted ligand counts around \(h\), \(\sum_h \sum_j w_{hj} L_j\), using the same neighbours and row-standardised spatial weights as the bivariate Moran's I test. This is the sum of the local ligand terms used byplotCCIspatial. IfFALSE, ligand counts are summed without weights over the hotspot bins and their neighbours, each bin counted once.
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.
Examples
if (FALSE) { # \dontrun{
# Continuing from the blisa() example:
# result <- blisa(spe, bin_size = 50, group = "cell_type")
# CCI is computed automatically when group is supplied to blisa();
# access the scores directly:
head(result$CCI_scores)
# Or compute / recompute scores explicitly:
binned <- hexBinCells(
as.data.frame(SpatialExperiment::spatialCoords(spe)),
SummarizedExperiment::assay(spe, "counts"),
bin_size = 50, group = spe$cell_type
)
result2 <- runCCI(result, counts_by_group = binned$counts_by_group,
overwrite = TRUE)
} # }
