
CellPhoneDB ligand-receptor analysis
cellphonedb_sc.RdRuns the CellPhoneDB v5 analysis on a SingleCells object. For every
interaction and every ordered (sender, receiver) cluster pair, partner a is
measured in the sender and partner b in the receiver. The interaction mean
is the average of the two partner means, zero if either is not expressed.
A complex takes the minimum over its subunits. The gate requires both
partners to be expressed in more than threshold of their cluster's cells.
Three methods, as in CellPhoneDB:
"statistical"- Permutes the cluster labels and reportsp = #(perm > real) / n_perm, 1 where the mean is zero or the gate fails."degs"- No permutations. The gate also needs partner a to be differentially expressed in the sender or partner b in the receiver, as given bydeg_table."simple"- Means and the expression gate only.
Reads the normalised layer of the L/R genes only, once. Interactions with any subunit missing from the object are dropped with a warning.
Usage
cellphonedb_sc(
object,
celltype_colname,
lr_db,
method = c("statistical", "degs", "simple"),
deg_table = NULL,
senders = NULL,
receivers = NULL,
gene_id_col = "gene_id",
params = params_sc_cellphonedb(),
.verbose = TRUE
)Arguments
- object
A
SingleCellsobject.- celltype_colname
String. Name of the cluster column in
obs. Cells with a missing label are ignored.- lr_db
data.table. The ligand-receptor database, see
get_cellphonedb_db(). Needsinteraction_id,partner_a,partner_band the subunit list columnsgenes_aandgenes_b.- method
String. One of
c("statistical", "degs", "simple").- deg_table
Optional data.table with the columns
cluster_idandgene, holding the differentially expressed genes per cluster, e.g. a filteredfind_all_markers_sc()result. Required formethod = "degs".- senders, receivers
Optional character vectors. Restrict the tested pairs to these sender and receiver clusters.
NULLuses all clusters.- gene_id_col
String. The var column holding the gene symbols used in
lr_db. A duplicated symbol resolves to its first gene. Defaults to"gene_id".- params
List. See
params_sc_cellphonedb().- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Value
A data.table with one row per interaction and cluster pair:
interaction_id, partner_a, partner_b - From
lr_db.sender, receiver - The cluster pair.
mean - The interaction mean.
pval - Permutation p-value,
NAunlessmethod = "statistical".gate - The expression gate, or the DEG gate for
method = "degs".