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
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.
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)
} # }