SimulateChICseq: Simulate count matrices from a Poisson distribution

View source: R/SimulationFunctions.R

SimulateChICseqR Documentation

Simulate count matrices from a Poisson distribution

Description

Simulate count matrices from a Poisson distribution

Usage

SimulateChICseq(
  ctype.name = "A",
  jseed = 0,
  shuffle.rows.seed = 0,
  frac.mutual.excl = 0.5,
  jspec = "hg38",
  jncells.per.rep = 250,
  jnbins = 5000,
  jlibmean = 12,
  jlibsd = 1,
  jlibp = 0.5,
  jzp = 1
)

Arguments

ctype.name

Name of "celltype" that these single counts come from. Default "A"

jseed

Random seed for simulating count matrices from Poisson distribution

shuffle.rows.seed

Random seed for shuffling rows. Changing this number and rerunning would generate counts from another "celltype".

frac.mutual.excl

Fraction of bins that will be made mutually exclusive between the second mark. This is done by swapping bins with the highest counts (i.e. largest lambda from Poisson) with the lowest counts.

jspec

Species is mm10 or hg38. Defines position information.

jncells.per.rep

number of cells per replicate. Generates 3 replicates. One for histone mark 1, one for histone mark 2, and one with histone mark 1 + 2

jnbins

Number of bins in the data

jlibmean

Average (mean) library size

jzp

Additional dropouts from Poisson (will still be Poisson after dropouts)

libsd

Standard deviation in library size

Value

ctype1.sim.counts.lst Simulated counts from the three replicates (hist 1, hist 2, hist1+2) and annotations of whether the bin is overlapping or mutually exclusive.

Examples


jspec <- "hg38"
jseed <- 0
jncells.per.rep <- 250
jnbins <- 10000
jlibmean <- 12
jlibsd <- 1
jlibp <- 0.5
jzp <- 1
shuffle.rows.seed <- jseed
sim.params <- list(jspec = jspec,
jseed = jseed,
jncells.per.rep = jncells.per.rep,
jnbins = jnbins,
jlibmean = jlibmean,
jlibsd = jlibsd,
jlibp = jlibp,
jzp = jzp)
ctype.sim.counts.lst <- lapply(ctypes, function(jctype){
ctypes <- c("A", "B", "C")
names(ctypes) <- ctypes

ctype.params <- list(ctype.name = c("A", "B", "C"),
                     jseed = c(0, 123, 999),
                     shuffle.rows.seed = c(0, 123, 999),
                     frac.mutual.excl = c(0.5, 0.5, 0.5))

ctype.params.lst <- lapply(ctypes, function(ctype){
  i <- which(ctype.params$ctype.name == ctype)
  return(list(ctype = ctype,
              jseed = ctype.params$jseed[[i]],
              shuffle.rows.seed = ctype.params$shuffle.rows.seed[[i]],
              frac.mutual.excl = ctype.params$frac.mutual.excl[[i]]))
})
SimulateChICseq(ctype.name = jctype,
                jseed = ctype.params.lst[[jctype]]$jseed,
                shuffle.rows.seed = ctype.params.lst[[jctype]]$shuffle.rows.seed,
                frac.mutual.excl = ctype.params.lst[[jctype]]$frac.mutual.excl)
})

jakeyeung/scChIX documentation built on May 7, 2023, 9:14 a.m.