score_lr_single {PopComm}R Documentation

Analyze Ligand-Receptor Projection Scores (Specified Sender and Receiver)

Description

This function calculates the projection scores for ligand-receptor (LR) pairs between specified sender and receiver cell types. The projection score is computed based on linear regression models, measuring the normalized distance of each sample's LR expression from the origin of the regression line.

Usage

score_lr_single(
  rna,
  sender,
  receiver,
  filtered_lr,
  sample_col,
  cell_type_col,
  min_cells = 50,
  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).

filtered_lr

A data frame of filtered ligand-receptor pairs from prior analysis (e.g., output of filter_lr_single). Must contain an "lr" column with pair identifiers in "Ligand_Receptor" format.

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).

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 with projection scores per sample and LR pair. Columns:

All input from filtered_lr

Original columns provided by the user in filtered_lr.

sample

Sample identifier.

score

Projection score (raw co-expression intensity).

normalized_score

Normalized score scaled between 0-1.

Rows are ordered by filtered_lr columns and descending score.

Returns NULL if:

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
  )

  # Analyzing ligand-receptor projection scores: Cardiac -> Perivascular
  result02s <- score_lr_single(
    rna = seurat_object,
    sender = "Cardiac",
    receiver = "Perivascular",
    filtered_lr = result01s,
    sample_col = "sample",
    cell_type_col = "cell.type",
    min_cells = 20,
    num_cores = 1,
    verbose = TRUE
  )

  if (!is.null(result02s)) {
  print(head(result02s))
  }


[Package PopComm version 0.1.0.1 Index]