Learn R Programming

RRphylo (version 2.5.0)

swapONE: Create alternative phylogenies from a given tree

Description

The function produces an alternative phylogeny with altered topology and branch length, and computes the Kuhner-Felsenstein (Kuhner & Felsenstein 1994) distance between original and 'swapped' tree.

Usage

swapONE(tree,node=NULL,si=0.5,si2=0.5,plot.swap=FALSE)

Arguments

tree

a phylogenetic tree. The tree needs not to be ultrametric or fully dichotomous.

node

if specified, the clades subtended by such node(s) are imposed to be monophyletic. In this case, the function can still swap tips within the clade.

si

the proportion of tips whose topologic arrangement will be swapped.

si2

the proportion of nodes whose age will be changed.

plot.swap

if TRUE, the function plots the swapped tree. Swapped positions appear in red. Nodes with altered ages appear in green.

Value

The function returns a list containing the 'swapped' version of the original tree, and the Kuhner-Felsenstein distance between the trees.

Details

swapONE changes the tree topology and branch lengths. Up to half of the tips, and half of the branch lengths can be changed randomly. Each randomly selected node is allowed to move up to 2 nodes apart from its original position.

References

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.

Examples

Run this code
# NOT RUN {
data("DataOrnithodirans")
DataOrnithodirans$treedino->treedino

## Case 1. change the topology and the branch lengths for the entire tree
swapONE(tree=treedino,si=0.5,si2=0.5,plot.swap=FALSE)

## Case 2. change the topology and the branch lengths of the
##         tree by keeping the monophyly of a specific clade
swapONE(tree=treedino,node=422,si=0.5,si2=0.5,plot.swap=FALSE)
# }

Run the code above in your browser using DataLab