coalescent.plot: Creates a (usually animated) simulation of gene coalescence...

View source: R/evolution.R

coalescent.plotR Documentation

Creates a (usually animated) simulation of gene coalescence within a population

Description

Coalescence or coalescent theory is a model for genetic drift within a population in which we envision gene copies merging or "coalescing" into ancestors in the past. This function generates a(n) (optionally animated) visualization of this process of coalescence within a population.

Usage

	coalescent.plot(n=10, ngen=20, colors=NULL, ...)
	## S3 method for class 'coalescent.plot'
print(x, ...)
	## S3 method for class 'coalescent.plot'
plot(x, ...)

Arguments

n

number of haploid individuals or gene copies.

ngen

number of generations.

colors

colors to use for plotting individuals and lines. By default, the function tries to use a contrasting color scheme such that adjacent allele copies are dissimilar (to facilitate visualization of the coalescent process.)

x

object of class "coalescent.plot" for print and plot methods.

...

optional arguments. For coalescent.plot optional arguments include: sleep, the time to pause between generations (set to 0.2s by default); lwd, the line width for parent-offspring lines in the coalescent geneology; and col.order, if colors=NULL, whether to use 'sequential' (col.order="sequential", the default) or 'alternating' (col.order="alternating") colors for adjacent alleles.

Value

Creates a plot or animation.

Invisibly returns an object of class "coalescent.plot" containing the alleles (coded numerically) and the parent-offspring relationships from the coalescent simulation. This object can be printed or re-plotted using print and plot methods. (See examples.)

Author(s)

Liam Revell liam.revell@umb.edu

See Also

drift.selection, genetic.drift

Examples

	coalescent.plot()
	## Not run: 
		coalescent.plot(n=20,ngen=30,col.order="alternating")
		object<-coalescent.plot()
		print(object)
		plot(object)
	
## End(Not run)

liamrevell/PopGen documentation built on Jan. 4, 2023, 10:02 p.m.