PCRcoal: The PCRcoal class

Description Usage Slots Methods Note Author(s) References See Also Examples

Description

PCRcoal is a class implementing the coalescent approach to PCR simulation developed by Weiss and von Haeseler (NAR, 1997).

Usage

PCRcoal( initial.size, nr.cycles, efficiencies, sample.size, max.tries=100 )

Returns a PCRcoal S4 object.

Slots

initial.size:

Number of template molecules.

nr.cycles:

Number of PCR cycles.

efficiencies:

A vector of per-cycle PCR efficiencies. It is recycled if its length is smaller than nr.cycles.

sample.size:

Number of molecules sampled after amplification.

max.tries:

Maximum number of tries when sampling a size trajectory with a large enough final size.

Methods

sample.tree:

Sample a tree, return as an ape phylo object.

sample.tnt:

Return the sampled tree, subsample sizes and size trajectories in a list.

sample.trs:

Return the sampled subsample sizes and size trajectories in a list.

Note

Author(s)

Botond Sipos

References

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

See Also

The ape and phylosim packages.

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
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)

pcrcoal documentation built on May 1, 2019, 8:03 p.m.

Related to PCRcoal in pcrcoal...