sim.bdh.taxa.gsa {SiPhyNetwork} | R Documentation |
Simulate a Phylogenetic Network to a Specified Number of Taxa
Description
Simulates a Phylogenetic Network under a birth-death-hybridization model. Simulates to a specified number of extant tips under the General Sampling Approach.
Usage
sim.bdh.taxa.gsa(
m,
n,
numbsim,
lambda,
mu,
nu,
hybprops,
hyb.inher.fxn,
frac = 1,
twolineages = FALSE,
complete = TRUE,
stochsampling = FALSE,
hyb.rate.fxn = NULL,
trait.model = NULL,
mrca = deprecated()
)
Arguments
m |
The number of taxa to simulate under the SSA |
n |
The number of taxa. |
numbsim |
Number of networks to simulate. |
lambda |
Speciation rate. |
mu |
Extinction rate. |
nu |
Hybridization rate. |
hybprops |
Vector that represents the proportion of Hybridizations that are lineage generative, lineage degenerative, and lineage neutral respectively. |
hyb.inher.fxn |
A function for drawing the hybrid inheritance probabilities. |
frac |
Sampling fraction: The proportion of extant tips included in the phylogeny (incomplete sampling). |
twolineages |
If |
complete |
If complete = TRUE, the tree with the extinct lineages is returned. If complete = FALSE, the extinct lineages are suppressed. |
stochsampling |
When |
hyb.rate.fxn |
The probability of a successful hybridization as a function of genetic distance between taxa. The default value of 'NULL“ assumes that hybridization success is independent of genetic distance between taxa. |
trait.model |
A list that dictates how a trait affects the hybridization process. The default value of |
mrca |
Details
hyb.inher.fxn
should return values between 0 and 1 and shouldn't require any arguments. E.g. make.beta.draw and make.uniform.draw create functions that fit these specifications
hyb.rate.fxn
should take one argument for the genetic distance. The function should be defined on the range [0,Inf)
and return values between [0,1]
trait.model
is a list with the following named elements:
initial
The initial trait state on the phylogenyhyb.event.fxn
A function that denotes the trait of a hybrid child after a hybridization event. The function should have the argumentsparent_states
andinheritance
.parent_states
is vector with the ploidy states of the hybrid parents whileinheritance
is the inheritance probability of the first lineage denoted inparent_states
.hyb.compatibility.fxn
A function that describes when hybridization events can occur between two taxa based on their traits. The function should have the argumentparent_states
, a vector with the trait states of the two parents to the hybrid child. The function should returnTRUE
for when a hybridization event is allowed to proceed andFALSE
otherwise.time.fxn
A function that describes how traits change over time. The function should have the argumentstrait_states
andtimestep
in that order.trait_states
is a vector containing the ploidy of all taxa whiletimestep
is the amount of time given for trait evolution. The function should return a vector with the updated ploidy states of all taxa.spec.fxn
A function that describes how the trait changes at speciation events.The function should have the argumenttip_state
which has the state of the lineage just before speciation. The function should return a vector with two values, one denoting the trait of each of the two new species after the event.
Value
out Returns a list of numbsim networks with the time since origin / most recent common ancestor being 'age.' If tree goes extinct or no tips are sampled, return value is '0'. If only one extant and no extinct tips are sampled, return value is '1'. Each network has an additional attribute "inheritance" that represents the inheritance probabilities on the edges in the "reticulation" attribute.
Examples
##smallest Quartan prime as seed for reproducibility
set.seed(17)
##Generate a tree with extinct leaves
net<-sim.bdh.taxa.gsa(m=21,n=5,1,3,2,0.5,c(1/3,1/3,1/3),
hyb.inher.fxn = make.uniform.draw(),complete=TRUE)[[1]]