
Upstream Regulator Analysis via decoupleR + CollecTRI
RunURA.RdInfers transcription factor activity from pseudobulk gene expression using decoupleR and the CollecTRI TF-target database. Optionally tests for differential TF activity between one or more condition pairs (limma when \(\geq 3\) donors per side; t-test otherwise).
Usage
RunURA(
seurat_object,
group.by = NULL,
donor.by = NULL,
split.by = NULL,
contrast.by = NULL,
contrast = NULL,
group.levels = NULL,
assay = "RNA",
layer = "data",
use_pseudobulk = TRUE,
force = FALSE,
network = NULL,
method = "ulm",
organism = "human",
n_top = 25L,
min_cells = 10L,
output_dir = NULL,
object_name = "",
subset_name = "",
plot = TRUE,
caffeinate = FALSE,
max_cells = NULL
)Arguments
- seurat_object
A Seurat object.
- group.by
Character or
NULL. Metadata column that defines the primary grouping (e.g."CellType","Cluster").NULLtreats all cells as one group.- donor.by
Character or
NULL. Replicates column (e.g."Donor.ID"). Enables limma-based differential testing when \(\geq 3\) donors per contrast arm.NULLfalls back to t-test.- split.by
Character or
NULL. Additional stratification column (e.g."Sex"). Included in the pseudobulk grouping, generatesgroup × splitcolumns in the activity matrix, and facets the bubble plot.- contrast.by
Character or
NULL. Condition column for DE (e.g."Diagnosis").- contrast
A single
c("test", "ref")pair or a list of such pairs, e.g.list(c("AD","Control"), c("MCI","Control")). Required whencontrast.byis set.- group.levels
Character vector or
NULL. Restrict to specific levels ofgroup.by.NULL= all levels.- assay
Character. Seurat assay. Default
"RNA".- layer
Character. Assay layer. Default
"data".- use_pseudobulk
Logical. When
TRUE(default) TF activity is inferred from pseudobulk expression averages — statistically rigorous for DE testing. WhenFALSE, decoupleR runs directly on the full single-cell matrix (all cells × genes) and activity scores are then averaged per group; simpler, works withoutdonor.by, but pseudoreplication means DE results should be interpreted with caution.- force
Logical. When
TRUE, recomputes pseudobulk even if a cached result is already stored inseurat_object@misc$pseudobulk. DefaultFALSE.- network
A
data.framewith columnssource,target,mor. Fetched from CollecTRI whenNULL.- method
One of
"ulm"(default),"viper","mlm".- organism
"human"(default) or"mouse".- n_top
Top N TFs to include in plots. Default
25L.- min_cells
Minimum cells per pseudobulk group. Default
10L.- output_dir
Directory for PDFs.
NULL= no files saved.- object_name
Character. Label prefix for output file names.
- subset_name
Character. Optional subset label appended to output file names.
- plot
Logical. Save plots. Default
TRUE.- caffeinate
Logical. Prevent the machine from sleeping during the run (macOS only; uses
caffeinate -i). DefaultFALSE.- max_cells
Integer or
NULL. Whenuse_pseudobulk = FALSEand the object has more cells than this value, a stratified random sample ofmax_cellscells is drawn before running decoupleR. Preserves group proportions.NULL(default) uses all cells.