Learn R Programming

⚠️There's a newer version (2.4-4) of this package.Take me there.

phytools (version 0.5-64)

Phylogenetic Tools for Comparative Biology (and Other Things)

Description

Package contains various functions for phylogenetic analysis. This functionality is concentrated in the phylogenetic analysis of comparative data from species. For example, the package includes functions for Bayesian and ML ancestral state estimation; visual simulation of trait evolution; fitting models of trait evolution with multiple Brownian rates and correlations; visualizing discrete and continuous character evolution using colors or projections into trait space; identifying the location of a change in the rate of character evolution on the tree; fast Brownian motion simulation and simulation under several other models of continuous trait evolution; fitting a model of correlated binary trait evolution; locating the position of a fossil or an recently extinct lineage on a tree using continuous character data with ML; plotting lineage accumulation through time, including across multiple trees (such as a Bayesian posterior sample); conducting an analysis called stochastic character mapping, in which character histories for a discrete trait are sampled from their posterior probability distribution under a model; conducting a multiple (i.e., partial) Mantel test; fitting a phylogenetic regression model with error in predictor and response variables; conducting a phylogenetic principal components analysis, a phylogenetic regression, a reduced major axis regression, a phylogenetic canonical correlation analysis, and a phylogenetic ANOVA; projecting a tree onto a geographic map; simulating discrete character histories on the tree; fitting a model in which a discrete character evolves under the threshold model; visualization of cospeciation; a simple statistical test for cospeciation between two trees. In addition to this phylogenetic comparative method functionality, the package also contains functions for a wide range of other purposes in phylogenetic biology. For instance, functionality in this package includes (but is not restricted to): adding taxa to a tree (including randomly, everywhere, or automatically to genera); generating all bi- and multi-furcating trees for a set of taxa; reducing a phylogeny to its backbone tree; dropping tips or adding tips to special types of phylogenetic trees; exporting a tree as an XML file; converting a tree with a mapped character to a tree with singleton nodes and one character state per edge; estimating a phylogeny using the least squares method; simulating birth-death trees under a range of conditions; rerooting trees; computing a consensus tree under multiple methods, including via minimization of the distance to other trees in the set; a wide range of visualizations of trees; and a variety of other manipulations and analyses that phylogenetic biologists may find useful for their research.

Copy Link

Version

Install

install.packages('phytools')

Monthly Downloads

8,304

Version

0.5-64

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Liam Revell

Last Published

December 5th, 2016

Functions in phytools (0.5-64)

add.color.bar

Add color bar to a plot
edgeProbs

Compute the relative frequencies of state changes along edges
fitBayes

Evolutionary model fitting with intraspecific variability using Bayesian MCMC
fitDiversityModel

Fit diversity-dependent phenotypic evolution model
getExtant

Returns a list of the extant or extinct lineages in a tree containing non-contemporaneous tips
multiRF

Computes Robinson-Foulds distance between a set of trees
getSisters

Get the sister node number, label, or set of nodes for a node or tip
paste.tree

Paste two trees together
nodeHeights

Compute the heights above the root of each node
phylo.to.map

Plot tree with tips linked to geographic coordinates
pbtree

Simulate pure-birth or birth-death stochastic tree or trees
phylo.toBackbone

Converts tree to backbone or vice versa
read.simmap

Read SIMMAP style trees from file
roundPhylogram

Plot a round phylogram
reorder.backbonePhylo

Reorders a backbone phylogeny
rstate

Pick a random state according to a vector of probabilities
skewers

Matrix comparison using the method of random skewers
splitEdgeColor

Split edge colors when descendant edges have different mapped states
anc.trend

Ancestral character estimation with a trend
ancThresh

Ancestral character estimation under the threshold model using Bayesian MCMC
add.arrow

Add an arrow pointing to a tip or node on the tree
densityMap

Plot posterior density of stochastic mapping on a tree
consensus.edges

Compute consensus edges for a tree under some criterion
collapseTree

Interactive tree visualizer
drop.tip.simmap

Drop tips or extract clade from tree with mapped discrete character
densityTree

Plots a posterior sample of trees
aic.w

Computes AIC weights
allFurcTrees

Generate all bi- and multifurcating unrooted trees
anoletree

Phylogeny of Greater Antillean anole ecomorph species with mapped discrete character
brownieREML

REML version of brownie.lite
brownie.lite

Likelihood test for rate variation in a continuous trait
applyBranchLengths

Applies the branch lengths of a reference tree to a target
describe.simmap

Summarizes a stochastic mapped tree or set of trees
fastAnc

Fast estimation of ML ancestral states
di2multi.simmap

Collapse branches of zero length to polytomy in stochastic map style tree
evolvcv.lite

Likelihood test for a shift in the evolutionary correlation between traits
evol.vcv

Likelihood test for variation in the evolutionary VCV matrix
fastBM

Fast Brownian simulation
lambda.transform

Lambda transformation of matrix
make.simmap

Simulate stochastic character maps on a phylogenetic tree or trees
likMlambda

Likelihood for joint lambda
map.overlap

Proportional overlap between two mapped character histories on a tree
mrp.supertree

Matrix representation parsimony supertree estimation
modified.Grafen

Computes modified Grafen edge lengths
pgls.Ives

Phylogenetic regression with intraspecific sampling error
phenogram

Plot phenogram (traitgram)
phylomorphospace

Creates phylomorphospace plot
phyloDesign

Compute design matrix for least squares analyses
phytools-package

phytools: Phylogenetic Tools for comparative biology (and other things)
rescaleSimmap

Rescale SIMMAP style tree
plot.backbonePhylo

Plots backbone tree with triangles as clades
resolveNode

Compute all possible resolutions of a node or all nodes in a multifurcating tree
sim.ratebystate

Conduct simulation of state dependent rate variation
sim.rates

Brownian simulation with multiple evolutionary rates
bind.tip

Attaches a new tip to a tree
bind.tree.simmap

Attaches a new tip to a tree
bmPlot

Simulates and visualizes discrete-time Brownian evolution on a phylogeny
branching.diffusion

Animation of branching random diffusion
drop.leaves

Drop all the leaves (tips) from a tree
drop.tip.contMap

Drop tip or tips from an object of class "contMap" or "densityMap"
estDiversity

Estimate diversity at each node of the tree
gammatest

Gamma test of Pybus & Harvey (2000)
evol.rate.mcmc

Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
genSeq

Simulate a DNA alignment on the tree under a model
ladderize.simmap

Ladderize a tree with a mapped discrete character
getStates

Get the states at nodes or tips from a mapped tree
ltt95

Creates a (1-$\alpha$)-percent CI for a set of LTTs
make.era.map

Create "era" map on a phylogenetic tree
mergeMappedStates

Merge two or more mapped states into one state
midpoint.root

Midpoint root a phylogeny
nodelabels.cophylo

Add labels to a plotted "cophylo" object
add.random

Add tips at random to the tree
add.everywhere

Add tip to all edges in a tree
optim.phylo.ls

Phylogeny inference using the least squares method
plotBranchbyTrait

Plot branch colors by a quantitative trait or value
plotSimmap

Plot stochastic character mapped tree
setMap

Set color map for objects of class "contMap" or "densityMap"
sampleFrom

Sample from a set of distributions
exhaustiveMP

Exhaustive and branch & bound MP optimization
expm

Matrix exponential
fitMk

Fits Mk model
getDescendants

Get descendant node numbers
getCladesofSize

Get all subtrees larger than or equal to a specified size
fitPagel

Function to test for correlated evolution of binary traits
plotThresh

Tree plotting with posterior probabilities of ancestral states from the threshold model
plotTree

Plots rooted phylogenetic tree
reroot

Re-root a tree along an edge
rerootingMethod

Get marginal ancestral state reconstructions by re-rooting
write.simmap

Write a stochastic character mapped tree to file
vcvPhylo

Calculates cophenetic (i.e., phylogenetic VCV) matrix
anc.Bayes

Bayesian ancestral character estimation
anc.ML

Ancestral character estimation using likelihood
ave.rates

Average the posterior rates
as.multiPhylo

Conversion to object of class "multiPhylo"
cladelabels

Add labels to subtrees of a plotted phylogeny
drop.clade

Drop a clade from a tree
dotTree

Creates a phylogenetic dot plot
collapse.to.star

Collapse a subtree to a star phylogeny
fastMRCA

Get the MRCA (or height above the root of the MRCA) of a pair of tip taxa
map.to.singleton

Converts a mapped tree to a tree with singleton nodes
findMRCA

Get the MRCA of a set of taxa
mapped.states

Returns a vector, matrix, or list of the mapped states on a tree or set of trees
paintSubTree

Paint sub-trees with a discrete character
orderMappedEdge

Order the columns of mapped.edge to match across trees
contMap

Map continuous trait evolution on the tree
cospeciation

Conducts a statistical test of cospeciation between two trees
cophylo

Creates a co-phylogenetic plot
countSimmap

Counts the number of character changes on a SIMMAP style tree or set of trees
locate.fossil

Locate a fossil lineage in a tree using continuous characters
locate.yeti

Locate a cryptic, recently extinct, or missing taxon on a tree
ls.tree

Least squares branch lengths for a given tree
ltt

Creates lineage-through-time plot (including extinct lineages)
minSplit

Finding the minimum (median) split in the posterior sample
minRotate

Rotates all nodes of the tree to minimize the difference in order with a vector
phyl.cca

Phylogenetic canonical correlation analysis
phyl.vcv

Compute evolutionary VCV matrix for a tree & dataset
phyl.RMA

Phylogenetic reduced major axis (RMA) regression
phyl.pairedttest

Phylogenetic paired t-test
phylosig

Compute phylogenetic signal with two methods
phylomorphospace3d

Creates tree-dimensional phylomorphospace plot
rateshift

Find the temporal position of one or more rate shifts
read.newick

Robust Newick style tree reader
starTree

Create star phylogeny
writeAncestors

Write a tree to file with ancestral states and (optionally) CIs at nodes
strahlerNumber

Computes Strahler number for trees and nodes
writeNexus

Write a tree to file in Nexus format
phylo.heatmap

Creates a phylogenetic heat map
phylANOVA

Phylogenetic ANOVA and post-hoc tests
plotTree.wBars

Plot a tree with bars at the tips
posterior.evolrate

Analysis of the posterior sample from evol.rate.mcmc
print.backbonePhylo

Print method for backbone phylogeny
ratebystate

Method for investigating the rate of one trait as a function of the state of another
sim.history

Simulate stochastic character history under some model
splitTree

Split tree at a point
threshState

Computes value for a threshold character from a liability and thresholds
splitplotTree

Plots a phylogeny in two columns
sim.corrs

Multivariate Brownian simulation with multiple correlations and rates
to.matrix

Convert a character vector to a binary matrix
add.species.to.genus

Add species to genus on a phylogeny or bind simulated species subtrees to a backbone genus tree
add.simmap.legend

Add legend to stochastically mapped tree
treeSlice

Slices the tree at a particular point and returns all subtrees
untangle

Attempts to untangle crossing branches for plotting
averageTree

Compute an average tree from a set of trees and related operations
bd

Convert object of class "birthdeath" to raw birth & death rates
export.as.xml

Export trees & data in XML format
fancyTree

Plots special types of phylogenetic trees
phyl.pca

Phylogenetic principal components analysis
phyl.resid

Phylogenetic size-correction via GLS regression
rotateNodes

Rotates a node or set of nodes in a phylogenetic tree
roundBranches

Rounds the branch lengths of a tree
multi.mantel

Multiple matrix regression (partial Mantel test)
multiC

Returns a list with phylogenetic VCV matrix for each mapped state
reorderSimmap

Reorder edges of a simmap tree
rep.phylo

Replicate a tree or set of trees
threshBayes

Threshold model using Bayesian MCMC
threshDIC

Deviance Information Criterion from the threshold model
markChanges

Add marked changes to a plotted tree with mapped discrete character
matchNodes

Matches nodes between two trees