Phylogenetic trees represent hypothesis about the history of clades. No phylogeny could be taken as ground truth, since both the age of common ancestors and the actual tree topology may differ substantially from reality, and usually differ across studies. Hence, accounting for phylogenetic uncertainty is much appropriate in comparative studies.
The function swapONE
provides a fast and effective way
to produce alternative tree topologies and node ages, swapping a
specified proportion of the tree tips and changing the ages of a
specified proportion of common ancestors (nodes). The user, though, may
indicate whether and which clades have to be kept monophyletic depending
on the recognition of well-supported clades. Tips within the
monophyletic clades can still be swapped. The function also returns the
Kuhner-Felsenstein (Kuhner & Felsenstein 1994) distance between
original and ‘swapped’ tree ($Kuhner-Felsenstein distance
).
The use may ask to plot the swapped tree, highlighting the species and
nodes with changed positions by coloring their branches and labels.
When species position has to be swapped, the function selects
exchangeable species pairs based on phylogenetic covariance and
proximity. In order to be swapped a species pair should share a certain
amount of phylogenetic time (which depends on phylogenetic structure)
and being less than 3 nodes apart. Then, a given proportion of these
pairs (indicated through the argument si
) is randomly
sampled to switch position. In some cases, also depending on tree
topology, the proportion of species actually swapping is less then the
imposed si
value. This happens when the age (meant distance
from the youngest species in the tree) of one of the species in the pair
is older then the age of the ancestors (i.e. nodes) of the other
species, which makes it impossible to swap them (see t3 and t1 in the
figure below). In any case, the switching never changes the distance of
the species from the tree root.
swapONE(tree,si=0.5,si2=0)->sw
The argument si2
specify the proportion of internal
nodes whose age should be shifted. Nodes are randomly sampled within the
tree, excluding the tree root. For each of them, the new age is derived
from a random uniform distribution ranging between the age of the
ancestor and the age of the closest descendant.
swapONE(tree,si=0,si2=0.5)->sw
# load the RRphylo example dataset including Felids tree
data("DataFelids")
$treefel->tree
DataFelids
# perform swapONE by changing both species position and node ages,
# and also keeping the genus Panthera monophyletic
swapONE(tree,si=0.5,si2=0.5,node=131,plot.swap = FALSE)->sw
Kuhner, M. K. & Felsenstein, J. (1994). A simulation comparison of phylogeny algorithms under equal and unequal evolutionary rates, Molecular Biology and Evolution, 11: 459-468.