lr_linear_model_discrete {PopComm}R Documentation

Compare Ligand-Receptor Interaction Scores with Group Variable using Linear Regression

Description

Perform linear regression analysis to compare ligand-receptor (LR) interaction scores across groups, handling both continuous and binary group variables (ident1 vs ident2 or all others).

Usage

lr_linear_model_discrete(
  lr_scores,
  metadata,
  group_variable,
  ident1,
  ident2 = NULL,
  covariates = NULL,
  fdr_threshold = 0.05
)

Arguments

lr_scores

Data frame containing LR interaction scores per sample (data frame).

metadata

Data frame containing sample metadata (data frame).

group_variable

Column name in metadata to compare groups (categorical or continuous) (character).

ident1

If categorical, group to compare (coded as 1) (character).

ident2

Reference group or list of groups (coded as 0). If None, uses all others (character).

covariates

Optional list of covariate column names (character vector).

fdr_threshold

Significance cutoff for adjusted p-values (numeric, default: 0.05).

Value

Data frame with ligand, receptor, sender, receiver, coef (coefficient, logFC), p-values, and adjusted p-values.

Examples


  # Long-running example (may take >10s)
  data(lr_scores_eg)
  data(metadata_eg)

  res <- lr_linear_model_discrete(
    lr_scores_eg, metadata_eg,
    group_variable = "IFN_type",
    ident1 = "high",
    covariates = c("Age_group", "Sex")
  )
  head(res)


[Package PopComm version 0.1.0.1 Index]