filter_lr_single {PopComm} | R Documentation |
Filter and Analyze Ligand-Receptor Pair Correlations (Specified Sender and Receiver)
Description
Filters ligand-receptor (LR) pairs and analyzes their correlations for specified sender and receiver cell types, and returns significant LR pairs based on user-defined thresholds.
Usage
filter_lr_single(
rna,
sender,
receiver,
lr_database = PopComm::lr_db,
sample_col,
cell_type_col,
min_cells = 50,
min_samples = 10,
min_cell_ratio = 0.1,
min_sample_ratio = 0.1,
cor_method = "spearman",
adjust_method = "BH",
min_adjust_p = 0.05,
min_cor = 0,
num_cores = 10,
verbose = TRUE
)
Arguments
rna |
A Seurat object containing single-cell RNA expression data. |
sender |
Cell type designated as the ligand sender (character). |
receiver |
Cell type designated as the receptor receiver (character). |
lr_database |
A data frame of ligand-receptor pairs with columns "ligand_gene_symbol" and "receptor_gene_symbol". |
sample_col |
Column name in Seurat metadata indicating sample identifiers (character). |
cell_type_col |
Column name in Seurat metadata indicating cell type classifications (character). |
min_cells |
Minimum cells required per sample for both sender and receiver (numeric, default 50). |
min_samples |
Minimum valid samples required to proceed (numeric, default 10). |
min_cell_ratio |
Minimum ratio of cells expressing ligand and receptor genes in sender or receiver cells (numeric, default 0.1). |
min_sample_ratio |
Minimum ratio of samples in which both the ligand and receptor genes must be expressed (numeric, default 0.1). |
cor_method |
Correlation method: "spearman" (default), "pearson", or "kendall". |
adjust_method |
P-value adjustment method (default "BH" for Benjamini-Hochberg). Options: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". |
min_adjust_p |
Adjusted p-value threshold for significance (numeric, default 0.05). |
min_cor |
Minimum correlation coefficient threshold (numeric, default 0). Must be |
num_cores |
Number of CPU cores for parallel processing (numeric, default 10). Automatically capped at (system cores - 1). |
verbose |
Logical indicating whether to print progress messages (logical, default: TRUE). |
Value
A data frame includes LR pairs with sufficient correlation and expression support across samples.
ligand , receptor |
Ligand and receptor gene symbols. |
cor |
Correlation coefficient. |
p_val |
Raw p-value. |
adjust.p |
Adjusted p-value. |
sender , receiver |
Sender and receiver cell types. |
slope |
Slope of the linear regression model. |
intercept |
Intercept of the linear regression model. |
Rows are ordered by ascending adjust.p
and descending cor
.
Returns NULL
if:
No cell types are found in the metadata.
Insufficient samples or cells remain after filtering.
No ligand-receptor pairs pass the filtering thresholds.
Examples
# Long-running example (may take >10s)
seurat_object <- load_example_seurat()
data(lr_db)
# Analyzing ligand-receptor interactions: Cardiac -> Perivascular
result01s <- filter_lr_single(
rna = seurat_object,
sender = "Cardiac",
receiver = "Perivascular",
lr_database = lr_db,
sample_col = "sample",
cell_type_col = "cell.type",
min_cells = 20,
min_samples = 10,
min_adjust_p = 0.5,
num_cores = 1,
verbose = TRUE
)
if (!is.null(result01s)) {
print(head(result01s))
}