one_step_single {PopComm} | R Documentation |
Analyze Ligand-Receptor Pair Correlations and Projection Scores (Specified Sender and Receiver)
Description
Performs integrated analysis of ligand-receptor (LR) pairs through two consecutive phases:
Filters LR pairs and analyzes correlations between specified cell types.
Calculates projection scores based on regression models for valid pairs. Returns comprehensive results combining statistical metrics.
Usage
one_step_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
Two data frames with columns:
ligand , receptor |
Ligand and receptor gene symbols (res1/res2). |
cor |
Correlation coefficient (res1/res2). |
p_val |
Raw p-value (res1/res2). |
adjust.p |
Adjusted p-value (res1/res2). |
sender , receiver |
Sender and receiver cell types (res1/res2). |
slope |
Slope of the linear regression model (res1/res2). |
intercept |
Intercept of the linear regression model (res1/res2). |
sample |
Sample identifier (res2). |
score |
Projection score (raw co-expression intensity) (res2). |
normalized_score |
Normalized score scaled between 0-1 (res2). |
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.
One or both of the specified sender and receiver cell types are missing in the data.
Fewer than two valid samples remain after filtering based on minimum cell number per sample.
Examples
# Long-running example (may take >10s)
seurat_object <- load_example_seurat()
data(lr_db)
# Integrated analysis with Cardiac -> Perivascular
res_single <- one_step_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(res_single)) {
print(head(res_single$res1))
print(head(res_single$res2))
}