Performs integrated analysis of ligand-receptor (LR) pairs through two consecutive phases: (1) Filters LR pairs and analyzes correlations across all cell types; (2) Calculates projection scores based on regression models for valid pairs. Returns comprehensive results combining statistical metrics. This function supports both Seurat objects and average expression matrices (matrix of gene expression data with cell types and samples as column names).
one_step_all(
rna,
lr_database,
sample_col,
cell_type_col,
id_sep,
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,
min_r2 = 0,
min_fstat = 0,
num_cores = 10,
verbose = TRUE
)Two data frames with columns:
Ligand and receptor gene symbols (res1/res2).
Correlation coefficient (res1/res2).
Raw p-value (res1/res2).
Adjusted p-value (res1/res2).
Sender and receiver cell types (res1/res2).
Slope of the linear regression model (res1/res2).
Intercept of the linear regression model (res1/res2).
Coefficient of determination (R-squared) of the linear regression model (res1/res2).
F-statistic of the linear regression model (res1/res2).
Sample identifier (res2).
Projection score (raw co-expression intensity) (res2).
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.
A Seurat object or a matrix containing single-cell RNA expression data.
A data frame of ligand-receptor pairs with columns "ligand_gene_symbol" and "receptor_gene_symbol".
Metadata column name (character) for sample identifiers in Seurat mode; Matrix mode uses column index (numeric).
Metadata column name (character) for cell type in Seurat mode; Matrix mode uses column index (numeric).
Separator used in matrix column names to split sample and cell type (e.g., -- for "Cardiac--sample1"). Only used in Matrix mode.
Minimum number of cells per sample for both sender and receiver (numeric, default 50). Only used in Seurat mode.
Minimum number of valid samples to proceed (numeric, default 10).
Minimum ratio of cells expressing ligand and receptor genes in sender or receiver cells (numeric, default 0.1). Only used in Seurat mode.
Minimum ratio of samples in which both the ligand and receptor genes must be expressed (numeric, default 0.1).
Correlation method: "spearman" (default), "pearson", or "kendall".
P-value adjustment method (default "BH" for Benjamini-Hochberg). Options: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none".
Adjusted p-value threshold for significance (numeric, default 0.05).
Minimum correlation coefficient threshold (numeric, default 0). Must be \(\ge\) 0.
Minimum R-squared threshold for the linear regression model (numeric, default 0). Must be \(\ge\) 0.
Minimum F-statistic threshold for the linear regression model (numeric, default 0). Must be \(\ge\) 0.
Number of CPU cores for parallel processing (numeric, default 10). Automatically capped at (system cores - 1).
Logical indicating whether to print progress messages (logical, default: TRUE).
# \donttest{
data(matrix_object)
data(lr_db)
# Integrated analysis across all cell types
res_all <- one_step_all(
rna = matrix_object,
lr_database = lr_db,
sample_col = 2,
cell_type_col = 1,
id_sep = "--",
min_samples = 10,
min_sample_ratio = 0.1,
min_adjust_p = 0.05,
num_cores = 1,
verbose = TRUE
)
if (!is.null(res_all)) {
print(head(res_all$res1))
print(head(res_all$res2))
}
# }
Run the code above in your browser using DataLab