The run_de function is the primary interface for performing differential expression (DE) or differential accessibility (DA) analysis. It accepts a features-by-cells matrix and a metadata data frame, or directly accepts single-cell objects (Seurat, monocle3, SingleCellExperiment, Signac, ArchR, or snap).
Input Requirements
- Matrix Input: A preprocessed features-by-cells matrix and a metadata data frame containing
cell_type, replicate, and label columns. - Object Input: A Seurat, monocle3, SingleCellExperiment, Signac, ArchR, or snap object. For these, Libra uses the metadata stored in the object.
Key Arguments
expr: The features-by-cells matrix or single-cell object.meta: Metadata data frame (if using matrix input).cell_type_col: Name of the column containing cell type annotations (default: cell_type).replicate_col: Name of the column containing replicates (default: replicate).label_col: Name of the column containing experimental conditions/labels (default: label).input_type: Set to scATAC for differential accessibility. Defaults to scRNA.de_family: Select the statistical framework (singlecell, pseudobulk, mixedmodel, or snapatac_findDAR).de_method: Select the specific statistical method within the family.de_type: Select the testing framework (e.g., LRT, Wald, QLF, voom, trend).n_threads: Number of cores to use (relevant for mixedmodel family).
library(Libra)
# Using matrix and metadata
DE = run_de(expr, meta = meta)
# Using custom column names
DE = run_de(expr, meta = meta, cell_type_col = "cell.type", label_col = "condition")
# Using a Seurat object directly
DE = run_de(sc)
# Running differential accessibility (scATAC)
DE = run_de(sc, input_type = 'scATAC')