Skip to contents

Generate gene expression count data from a Poisson model based on the continuous gene expression rates generated from a normal model, incorporating varying scaling factors (library sizes) across cells.

Usage

poisson_count_sim_var_scale(
  sim_data,
  p_scale_mean = 5e+05,
  p_scale_sd = 1e+05,
  p_offset = 1/5e+05
)

Arguments

sim_data

A dataset of list type generated from normal_data_sim()

p_scale_mean

The mean of the normal distribution where the library size is drawn from

p_scale_sd

The variance of the normal distribution where the library size is drawn from

p_offset

An offset number added to the input expression rates

Value

A list that has a sample by gene count matrix added to the original dataset input.

Details

Count \(c_{ij}\) is generated from a Poisson model based on rate \(y_{ij}\) and library size (or scaling factor) \(L_i\) generated from a normal model: $$L_i \sim N(\text{p_scale_mean}, \text{p_scale_sd}^2)$$ $$L_i = max(L_i, 0)$$ $$c_{ij} \sim Pois(L_i exp(y_{ij} + \text{p_offset}))$$

Examples

set.seed(12345)
beta_true <- rbind(c(1, 0, 0, 0, 0), c(0, 0.8, 0, 0, 0))
sim_data <- normal_data_sim(N = 4000, P = 6000, beta_true = beta_true)
sim_data <- poisson_count_sim_var_scale(sim_data)