MakeSimulation: Simulate ChIP-seq read count matrixes

Description Usage Arguments Value See Also Examples

View source: R/z_simulation.R

Description

The MakeSimulation function generates random read count matrixes presenting distinct populations accross simulated ChIP and Input samples. By design the first population is globally invariable, such that the true value of normalization factors between the simulated conditions is always equal to 1.0. The simulated variable populations can be defined using the DefineSimulation function.

Usage

1
MakeSimulation(p = NULL, m = NULL, f = NULL)

Arguments

p

integer vector of population sizes, the first one corresponding to the invariable population.

m

matrix of parameters for the variable populations, which can be produced by calling the DefineSimulation function.

f

list of functions allowing to use custom generators for simulated measurements (default = NULL, recommended).

Value

MakeSimulation returns a list with the following elements:

data

matrix of simulated ChIP-seq read counts.

group

population memberships.

See Also

DefineSimulation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Simulation of a read count matrix with 3 populations of 10000 observations
p <- c(10000, 10000, 10000)
m <- DefineSimulation(
  chip = 5, patterns = c("^", "v"), enrichment = c(1.0, 3), replicate = 2
)
r <-  MakeSimulation(p = p, m = m)

grp <- r$group # Population memberships
cnt <- r$data  # Simulated counts

# Prepare figure layout and graphic options
layout(matrix(1:4, 2, 2, byrow = TRUE))
par(pch = 20)

# Show the empirical distribution of simulated populations
l2c <- log2(DitherCounts(cnt)) # Dithering and log2 transformation
xyl <- range(l2c[FiniteValues(l2c), ])

r <- PlotCountDistributions(l2c, ylim = xyl, main = "Total")
for(i in sort(unique(grp))) {
  main <- ifelse(i == 1, "Invariable subset", paste("Variable subset", i - 1))
  r <- PlotCountDistributions(l2c[grp == i, ], ylim = xyl, main = main)
}

benja0x40/Tightrope documentation built on May 24, 2019, 1:35 a.m.