View source: R/simulclustphyl.R
simulate_clustered_phylogeny | R Documentation |
Simulate a phylogenetic tree that has a given number of clades, each with a given number of tips.
simulate_clustered_phylogeny(v_sizeclusts, joining_branchlengths = NULL,
f_simclustphyl = "sim.bd.taxa_Yule1", joiningphyl = NULL,
b_change_joining_branches = FALSE, ...)
v_sizeclusts |
A vector with the sizes of the clades/clusters. |
joining_branchlengths |
Default |
f_simclustphyl |
What function to use to simulate the phylogeny inside each cluster.
The default value of "sim.bd.taxa_Yule1" corresponds to a pure birth tree generated by
|
joiningphyl |
By what phylogeny are the clades to be joined by. Either |
b_change_joining_branches |
Logical, if joining phylogeny (parameter |
... |
Parameters to be passed to user provided |
The resulting object is a clustered_phylo
object which inherits from the phylo
class and enhances it.
Apart from the standard phylo
fields it has two additional ones:
a named list with length equalling the number of clades/clusters plus 1. The first element
of the list is called joining_tree
and contains the indices (row numbers of the edge
matrix,
indices of the edge_length
vector) of the edges inside the subtree joining the clusters.
Afterwords element (i+1) is named cluster_i and contains a numeric vector with the indices of the edges
inside clade i.
a named list with length equalling the number of clades/clusters. Each field of the list is a numeric vector containing the indices of the tips inside the clade. The names of element i of the list is cluster_i.
Krzysztof Bartoszek
Bartoszek K. and Vasterlund A. (2020) "Old Techniques for New Times": the RMaCzek package for producing Czekanowski's diagrams Biometrical Letters 57(2):89-118.
RNGversion(min(as.character(getRversion()),"3.6.1"))
set.seed(12345, kind = "Mersenne-Twister", normal.kind = "Inversion")
## We use a wrapper function for illustration
## a single phylo object
my_sim.bd.taxa<-function(n,...){
ape::rphylo(n=n,...)
}
phyltree1<-simulate_clustered_phylogeny(v_sizeclusts=c(5,5,5),f_simclustphyl=my_sim.bd.taxa,
b_change_joining_branches=TRUE, joining_branchlengths=c(20,NA),joining=my_sim.bd.taxa,
birth=1,death=0)
RNGversion(min(as.character(getRversion()),"3.6.1"))
set.seed(12345, kind = "Mersenne-Twister", normal.kind = "Inversion")
## The below code should return the same tree as above
phyltree2<-simulate_clustered_phylogeny(v_sizeclusts=c(5,5,5),f_simclustphyl="sim.bd.taxa_Yule1",
b_change_joining_branches=TRUE, joining_branchlengths=c(20,NA),joining="sim.bd.taxa_Yule1")
## The resulting phylogeny is not ultrametric, if ultrametricity is required, then some procedure
## has to be employed, e.g.
## phyltree1_u<-phytools::force.ultrametric(phyltree1, method="extend")
RNGversion(as.character(getRversion()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.