Simulate scRNA-seq data under different experimental settings and compute statistical power to detect differential expression (DE) using a user-specified DE function.
Usage
runRescueSimPower(
baseParams,
scenarios,
deFunction,
nSim = 1,
padjThresh = 0.05,
returnFDR = FALSE,
conditions = NULL,
saveSimPath = NULL,
saveDePath = NULL,
verbose = TRUE,
...
)Arguments
- baseParams
A
RescueSimParamsobject containing baseline simulation parameters.- scenarios
A data.frame specifying simulation settings to vary. Column names must match slots in the
RescueSimParamsobject. Each row defines one scenario.- deFunction
A function that takes a
SingleCellExperimentobject simulated usingsimRescueDataand returns a data.frame with columnsgeneandpadj.- nSim
Integer specifying the number of simulations to run per scenario. Default is 1.
- padjThresh
Significance threshold to call DE (e.g., FDR < 0.05). Default is 0.05.
- returnFDR
Logical. Whether to calculate and return the false discovery rate (FDR) along with power. Default is TRUE.
- conditions
A character vector of length 2 specifying the conditions to compare (e.g.,
c("time1", "time3_group1")). IfNULL(default), the comparison is inferred based on available conditions inrowData, comparing the baseline condition (e.g.,"time0","group0", or"time0_group0") to the final condition (e.g., last timepoint, or group 1 at the final timepoint).- saveSimPath
Optional path to directory where simulated SCE objects should be saved as .rds files. If NULL (default), simulated data is not saved.
- saveDePath
Optional path to directory where DE result data.frames should be saved as .rds files. If NULL (default), results are not saved.
- verbose
Logical. Whether to print progress messages. Default is TRUE.
- ...
Additional arguments passed to
deFunction().
Value
A data.frame with one row per simulation replicate, including:
Power: proportion of truly DE genes detected
FDR: false discovery rate (if
returnFDR = TRUE)Scenario settings and simulation number
The reference and comparison condition used
Optionally, simulated datasets and DE results can be saved to disk.
Details
For each scenario, this function simulates nSim datasets based on the,
supplied settings, applies the user-supplied DE method, and
calculates power as the proportion of true DE genes correctly identified.
DE status is determined by assessing equality in the simulated log2 fold-change values
between conditions. False discovery rate (FDR) is optionally
calculated as the proportion of genes called DE that are not truly DE.