simPCR: PCR Simulator

Description Usage Arguments Details Value See Also Examples

View source: R/simPCR.r

Description

Simulates the Polymerase Chain Reaction (PCR) process.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
simPCR(
  data,
  kit = NULL,
  method = "DEFAULT",
  pcr.cyc = 30,
  pcr.prob = 0.8,
  sd.pcr.prob = 0,
  stutter = TRUE,
  stutter.prob = 0.002,
  sd.stutter.prob = 0,
  stutter.reg = FALSE,
  vol.aliq = 10,
  sd.vol.aliq = 0,
  vol.pcr = 25,
  sd.vol.pcr = 0,
  debug = FALSE
)

Arguments

data

data.frame with simulated data. Preferably output from simExtraction. Required columns are 'Marker', 'Allele', 'Sim', Volume', and 'DNA'.

kit

string representing the typing kit used, or data.frame with kit characteristics. Provides locus specific PCR efficiency and stutter probabilities. If NULL pcr.prob and stutter.prob will be used for all loci.

method

string representing the method of the specified kit.

pcr.cyc

numeric for the number of PCR cycles.

pcr.prob

numeric for the PCR efficiency (probability amplifying a DNA molecule). Only used if kit is NULL.

sd.pcr.prob

numeric for the standard deviation of pcr.prob.

stutter

logical to simulate stutters.

stutter.prob

numeric for the probability generating a stutter. Only used if kit is NULL.

sd.stutter.prob

numeric for the standard deviation of stutter.prob.

stutter.reg

logical to use regression for stutter probability.

vol.aliq

numeric for the aliquot extract forwarded to PCR.

sd.vol.aliq

numeric for the standard deviation of vol.aliq.

vol.pcr

numeric for the total PCR reaction volume.

sd.vol.pcr

numeric for the standard deviation of vol.pcr.

debug

logical to print debug information.

Details

Simulates the PCR process by a series of binomial distributions, or multinomial distributions if stutter=TRUE. The PCR probability/ efficiency can be specified globally or per locus. Probability of stutter formation can be specified globally, per locus, or per locus and allele size.

Value

data.frame with simulation results in columns 'PCR.Pip.Vol', 'PCR.Aliq.Prob', 'PCR.DNA', 'PCR.Vol', 'PCR.Prob', 'PCR.Prob.Stutter', 'PCR.Amplicon', 'PCR.Stutter.1', 'PCR.Stutter.2', and updated 'DNA' column (added if needed).

See Also

simExtraction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Create a data frame with a DNA profile.
markers = rep(c("D3S1358","TH01","FGA"), each=2)
alleles = c(15,18,6,10,25,25)
df <- data.frame(Marker=markers, Allele=alleles)

# Simulate profile.
smpl <- simProfile(data=df, sim=10)

# Simulate sample.
smpl <- simSample(data=smpl, cells=1000, sd.cells=200)

# Simulate extraction.
smpl <- simExtraction(data=smpl, vol.ex=200, sd.vol=10, prob.ex=0.6, sd.prob=0.1)

# Simulate PCR with 95% PCR efficiency and 0.2% stutter probability for all loci.
res <- simPCR(data=smpl, pcr.prob=0.95, pcr.cyc=30, vol.aliq=10,
 sd.vol.aliq=0.1, vol.pcr=25, sd.vol.pcr=1)

# Simulate PCR with locus specific PCR efficiency and stutter probability.
res <- simPCR(data=smpl, kit="ESX17", pcr.cyc=30, vol.aliq=10,
 sd.vol.aliq=0.1, vol.pcr=25, sd.vol.pcr=1)

# Simulate PCR with locus specific PCR efficiency and stutter probability.
res <- simPCR(data=smpl, kit="ESX17", pcr.cyc=30, vol.aliq=10,
 sd.vol.aliq=0.1, vol.pcr=25, sd.vol.pcr=1, stutter.reg=TRUE)

OskarHansson/pcrsim documentation built on Jan. 22, 2022, 11:55 a.m.