Skip to contents

Simulate count data using model fit with lucida()

Usage

simulateCountData(
  fit,
  formula,
  data,
  target,
  logFC = 1,
  pDE = 0.1,
  libScaleFactor = 1,
  sigSq_gScaleFactor = 1,
  verbose = TRUE
)

Arguments

fit

model fit from lucida()

formula

model formula

data

data.frame to use for covariates. Should be colData(sce) of the sce fed to lucida()

target

variable in data used to simulate differential expression

logFC

log fold change for differentially expressed genes

pDE

proportion of genes simulated to be differentially expressed

libScaleFactor

scale the library size by this factor

sigSq_gScaleFactor

scale sigSq_g by this factor

verbose

show messages

Value

SingleCellExperiment with simulated data. Parameter stored in metadata(.)

Examples

library(SingleCellExperiment)

# Load example data
data(example_sce, package="muscat")
sce <- example_sce

# Compute library size for each cell
sce$libSize <- colSums(counts(sce))

# Specify regression formula and cell annotation 
form <- ~ group_id + (1|sample_id)
fit <- lucida(sce, form, "cluster_id", verbose=FALSE)
#> B cells 
#> CD14+ Monocytes 
#> CD4 T cells 
#> CD8 T cells 
#> FCGR3A+ Monocytes 

sceSim <- simulateCountData(fit, form, colData(sce), target="group_id")
#> Simulating each cell type...
#> Merging results...