Learn R Programming

dpcR (version 0.1.2-1)

sim_ddpcr: Simulate Droplet Digital PCR

Description

A function that simulates results of a droplet digital PCR.

Usage

sim_ddpcr(m, n, times, n_exp = 1, dube = FALSE, pos_sums = FALSE, fluo = NULL)

Arguments

m
the total number of template molecules added to the plate. Must be a positive integer.
n
the number of chambers per plate. Must be a positive integer.
times
number of repetitions (see Details).
n_exp
the number of experiments that are simulated by the function. Cannot have higher value than the times argument.
dube
if TRUE, the function is strict implementation of digital PCR simulation (as in Dube et al., 2008). If FALSE, the function calculates only approximation of Dube's experiment. See Details and References.
pos_sums
if TRUE, function returns only the total number of positive (containing at least one molecule) chamber per panel. If FALSE, the functions returns a vector of length equal to the number of chambers. Each element of the v
fluo
if NULL, the function calculates number of molecules per well or total number of positive droplets. If list of two, the first argument defines smoothness of the fluorescence curve and second space between two consecutive measured droplets

Value

  • If the pos_sums argument has value FALSE, the function returns matrix with $n$ rows and $n_panels$ columns. Each column represents one plate. Type of such simulation would be "nm". If the pos_sums argument has value TRUE, the function return matrix with one row and $n_panels$ columns. Each column contains the total number of positive chambers in each plate and type of simulation would be set as "tp".

    In each case the value is an object of the ddpcr class.

Details

The function contains two implementations of the array digital PCR simulation. First one was described in Dube at. al (2008). This method is based on random distributing $m \times times$ molecules between $n \times times$ chambers. After this step, the required number of plates is created by the random sampling of chambers without replacement. The above method is used, when the dube argument has value TRUE.

The higher the value of the argument times, the simulation result is closer to theoretical calculations.

See Also

sim_adpcr.

Examples

Run this code
#simulate fluorescence data
tmp_VIC <- sim_ddpcr(m = 7, n = 20, times = 5, fluo = list(0.1, 0))
tmp_FAM <- sim_ddpcr(m = 15, n = 20, times = 5, fluo = list(0.1, 0))
par(mfrow = c(2,1))
plot(tmp_VIC, col = "green", type = "l")
plot(tmp_FAM, col = "blue", type = "l")
summary(tmp_FAM)

summary(sim_ddpcr(m = 7, n = 20, times = 5, n_exp = 5))

Run the code above in your browser using DataLab