Learn R Programming

BMhyd (version 1.2-8)

SimulateNetwork: Simulate phylogenetic network

Description

Simulate network with desired number of taxa and number of hybrid.

Usage

SimulateNetwork(ntax.nonhybrid=100, ntax.hybrid=10, flow.proportion=0.5, origin.type=c("clade", "individual"), birth = 1, death = 0.5, sample.f = 0.5, tree.height = 1, allow.ghost=FALSE)

Arguments

ntax.nonhybrid
number of non hybrid taxa.
ntax.hybrid
number of hybrid taxa.
flow.proportion
the gene flow proportion from the parent.
origin.type
the type where the hybrids were formed. clade: hybrid formed and then speciate; individial: hybrid species formed and evolved without speciation.
birth
birth rate for the tree speciation.
death
death rate (extinction) of the tree.
sample.f
sampling frequency.
tree.height
the height of the tree.
allow.ghost
allows ghost lineage persists hybridization for a while and then goes extinct. Otherwise, hybridization event will be between coeval with extant descedants.

Value

a list that contains
phy
a birth death tree with number of taxa of ntax.nonhybrid + ntax.hybrid
flow
The flow structure of the gene flow

Details

This function generates tree with relevant hybridization information (the structure of gene flow information). The gene flow must happen on its stem edge, which starts at shortest from root and goes up to longest from root. Gene flow cannot go back in time. In general, gene flow can go forward in time via ghost lineages. If no ghost lineages, then there must be temporal overlap between the donor and recipient lineages. So the tipward end of the donor edge must be later than the rootward end of the recipient edge. When the non of hybris is 1 and clade sampling, this will do individual sampling instead.

References

Jhwueng D.C. and O'Meara B.C. 2015. Trait evolution on phylogenetic networks. Submitted.

Examples

Run this code
	library(TreeSim)
	#set up the number for non hybrid species
	non.hybrid <- 3
	#set up the number for hybrid species
	hybrid <- 1
	#set up the gene flow porportion
	flow<- 0.5
	#set pu the hybridization type to original
	origins<- "individual"
	#start to simulate the network
	network<-SimulateNetwork(ntax.nonhybrid=non.hybrid, ntax.hybrid=hybrid, 
	flow.proportion=flow, origin.type="individual", birth = 1, death = 0.5, 
	sample.f = 0.5, tree.height = 1, allow.ghost=FALSE)
	#print out the result
	(network)
	

Run the code above in your browser using DataLab