Aggregate and analyze cell-cell communication at cluster level.
Aggregate cell-cell communication to cluster-cluster level and optionally perform permutation testing.
Usage
cluster_communication(
seurat_obj,
database_name,
clustering,
lr_pair = NULL,
pathway_name = NULL,
n_permutations = 100L,
seed = NULL,
verbose = TRUE
)Arguments
- seurat_obj
Seurat object with COMMOTR results.
- database_name
Name of database.
- clustering
Name of metadata column containing cluster assignments, or a factor/character vector of cluster assignments.
- lr_pair
Specific LR pair (if NULL, uses pathway_name or total).
- pathway_name
Pathway name (if lr_pair is NULL).
- n_permutations
Number of permutations for significance testing (default: 100). Set to 0 to skip.
- seed
Random seed for permutation.
- verbose
Print progress messages.
Details
For each cluster pair (i, j), computes the total communication from cells in cluster i to cells in cluster j. If permutation testing is enabled, p-values are computed by randomly permuting cluster labels.
Examples
if (FALSE) { # \dontrun{
# After running spatial_communication
seurat_obj <- cluster_communication(
seurat_obj,
database_name = "CellChat",
clustering = "seurat_clusters",
pathway_name = "TGFb",
n_permutations = 100
)
# Plot results
plot_cluster_communication(
seurat_obj,
database_name = "CellChat",
clustering = "seurat_clusters",
key = "TGFb"
)
} # }