seqsim: Simulate sequencing from a pool of DNA molecules with...

Description Usage Arguments Value See Also

View source: R/seqsim.R

Description

Simulated amplification and sequencing of a pool of (DNA or RNA) fragments with the specified abundances (i.e. copy numbers). The actual pre-amplification abundances are multiplied with molecules, which would typically be set to "2" if fragments are double-stranded and both strands are possible templates for the DNA polymerase (although leaving molecules at one and doubling the abundances would have the same effect). By default, the PCR simulation uses an approximation that assumes many (actually, infinitly) many cycles, but a finite number of cycles can be specified instead.

After amplification, reads are sampled from the (random) post-amplification abundance distribution, such that the total library size is reads.target on average. The actual number of reads will fluctuate randomly around that average, which reflects reality more closely than always exactly hitting the targetted number of sequencing reads.

The actual read count simulation is performed by rgwpcrpois

Usage

1
2
3
4
5
6
7
8
seqsim(
  abundances,
  reads.target,
  efficiency,
  molecules = 1,
  method = NULL,
  cycles = Inf
)

Arguments

abundances

vector of (integral) abundances of different (DNA or RNA) fragments

reads.target

the target for the total number of sequencing reads

efficiency

efficiency of amplification

molecules

initial copy number of fragments

method

the method used to draw from the PCR distribution. "simulate" simulates a Galton-Watson branching process modeling PCR, "gamma" uses approximates the PCR distribution with a Gamma distribution. By default, the Gamma approximation is used for small efficiencies, where it is quite good and where simulations are computationally expensive.

cycles

number of amplification cycles used for simulation. By default, a large enough value is used to make the results virtually indistinguishable from the limit for cycles \to ∞

Value

a vector with the same length as abundances containing a read count for every fragment

See Also

gwpcrpois


Cibiv/gwpcR documentation built on Aug. 31, 2021, 1:20 p.m.