Creates a connectomic edgelist from a Seurat object. The connectome represents all possible ligand-receptor interactions between cell populations, weighted by expression levels and statistical significance.
Usage
CreateConnectome(
object,
LR.database = "fantom5",
species = NULL,
include.putative = TRUE,
include.rejected = FALSE,
p.values = TRUE,
max.cells.per.ident = NULL,
min.cells.per.ident = NULL,
weight.definition.norm = "product",
weight.definition.scale = "mean",
custom.list = NULL,
calculate.DOR = FALSE,
assay = "RNA",
parallel = FALSE,
n.cores = NULL,
...
)Arguments
- object
A Seurat object with normalized and scaled data
- LR.database
Ligand-receptor database to use. Either 'fantom5' (default) or 'custom'. If 'custom', provide a dataframe via custom.list parameter.
- species
Species for FANTOM5 database. Required if LR.database = 'fantom5'. Options: 'human', 'mouse', 'rat', or 'pig'
- include.putative
Include putative ligand-receptor pairs from FANTOM5. Default TRUE.
- include.rejected
Include pairs labeled "EXCLUDED" in FANTOM5. Default FALSE.
- p.values
Calculate Wilcoxon Rank Sum test p-values. Default TRUE. Set to FALSE for faster computation when statistical testing is not needed.
- max.cells.per.ident
Maximum cells per identity for downsampling. Default NULL (no downsampling). Useful for large datasets.
- min.cells.per.ident
Minimum cells required per identity. Default NULL. Clusters below this threshold are excluded from analysis.
- weight.definition.norm
Method for edge weight from normalized data. Options: 'sum', 'mean', or 'product' (default).
- weight.definition.scale
Method for edge weight from scaled data. Options: 'sum', 'mean' (default), or 'product'.
- custom.list
Dataframe with custom ligand-receptor pairs. Required columns: ligand (col 1), receptor (col 2), mode/category (col 3).
- calculate.DOR
Calculate log-normalized Diagnostic Odds Ratio. Default FALSE.
- assay
Seurat assay to use. Default 'RNA'. Also accepts 'SCT'.
- parallel
Use parallel processing for p-value calculations. Default FALSE.
- n.cores
Number of cores for parallel processing. Default: detectCores() - 1
- ...
Additional arguments passed to internal functions
Value
A data.frame containing the connectomic edgelist with columns: source, target, ligand, receptor, pair, mode, expression values, z-scores, percent expressing, edge weights, and optionally p-values and DOR.
Details
The function calculates edge weights using the formula specified by weight.definition.norm and weight.definition.scale parameters:
'product': ligand * receptor (captures co-expression)
'sum': ligand + receptor (additive contribution)
'mean': (ligand + receptor) / 2 (average contribution)
Examples
if (FALSE) { # \dontrun{
# Basic usage
connectome <- CreateConnectome(seurat_obj, species = "human")
# Without p-value calculation (faster)
connectome <- CreateConnectome(seurat_obj, species = "human", p.values = FALSE)
# With custom ligand-receptor list
my_lr <- data.frame(ligand = c("IL6", "TNF"), receptor = c("IL6R", "TNFRSF1A"),
mode = c("cytokine", "cytokine"))
connectome <- CreateConnectome(seurat_obj, LR.database = "custom", custom.list = my_lr)
} # }