PCRcoal is a class implementing the coalescent approach to PCR simulation developed by Weiss and von Haeseler (NAR, 1997).
PCRcoal S4 object.
Number of template molecules.
Number of PCR cycles.
A vector of per-cycle PCR efficiencies. It is recycled if its length is smaller than
Number of molecules sampled after amplification.
Maximum number of tries when sampling a size trajectory with a large enough final size.
Sample a tree, return as an
Return the sampled tree, subsample sizes and size trajectories in a list.
Return the sampled subsample sizes and size trajectories in a list.
The original method of Weiss and von Haeseler produces a tree containing a multifurcating root node connected to the subtrees
corresponding to the different subsamples. In order to be able to store the output in
PCRcoal randomly breaks the polytomy by "coalescing" the subsample trees with zero branch lengths. Some branch length might be non-zero, in the case a subsample coalesced into one molecule which accumulated branch length ("replication count") in the previous cycles.
If the cycle number and/or the efficiencies are small, it can happen that the number of the molecules after the amplification is less than the specified sample size.
PCRcoal will try sampling size trajectories
max.tries times (100 by default) to get enough amplified molecules and then aborts the simulation.
Weiss, G, von Haeseler, A (1997) A coalescent approach to the polymerase chain reaction. NAR 25(15): 3082-3087 http://dx.doi.org/10.1093/nar/25.15.3082
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
# Construct a PCRcoal object # and specify the experimental conditions: sim <-PCRcoal( initial.size =5, sample.size =10, nr.cycles =20, efficiencies =c(rep(0.1, 30)) ) ## ## Method: sample.tree ## # Sample a coalescent tree: tree <- sample.tree(sim) # Print tree info: print(tree) # Plot the tree: plot(tree) ## ## Method: sample.tnt ## # Sample a coalescent tree with subsample sizes and # size trajectories: res <- sample.tnt(sim) # Print subsample sizes: print(res$subsamples) # Print size trajectories: print(res$trajectories) # Print tree info: print(res$phylo) ## ## Method: sample.trs ## # Sample subsample sizes and size trajectories: res <- sample.trs(sim) # Print subsample sizes: print(res$subsamples) # Print size trajectories: print(res$trajectories) ## ## Simulating mutations using PhyloSim ## # Sample tree: tree <- sample.tree(sim) # Load the phylosim package library(phylosim) # Construct a PhyloSim object, set up the root # sequence and the substitution process: psim <- PhyloSim( phylo = tree, root.seq=sampleStates( NucleotideSequence(length=10,processes=list(list(JC69())) ) ) ) # Scale the tree: scaleTree(psim,0.1) # Simulate mutations: Simulate(psim) # Plot the resulting alignment: plot(psim,plot.ancestors=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.