Learn R Programming

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

phytools (version 1.2-0)

Phylogenetic Tools for Comparative Biology (and Other Things)

Description

A wide range of functions for phylogenetic analysis - concentrated in phylogenetic comparative biology, but also including numerous methods for visualizing, manipulating, reading or writing, and even inferring phylogenetic trees. Included among the functions in phylogenetic comparative biology are various for ancestral state reconstruction, model-fitting, and simulation of phylogenies and data, for continuous, discrete, and multivariate characters. A broad range of plotting methods for phylogenies and comparative data include, but are not restricted to, methods for mapping trait evolution on trees, for projecting trees into phenotypic space or a geographic map, and for visualizing correlated speciation between trees. Finally, numerous functions are designed for reading, writing, analyzing, inferring, simulating, and manipulating phylogenetic trees and comparative data. For instance, there are functions for randomly or non-randomly attaching species or clades to a phylogeny, for computing consensus phylogenies from a set, for simulating trees and phylogenetic data under a range of models, and for a wide variety of other manipulations and analyses that phylogenetic biologists might find useful in their research.

Copy Link

Version

Install

install.packages('phytools')

Monthly Downloads

11,043

Version

1.2-0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

September 1st, 2022

Functions in phytools (1.2-0)

densityTree

Plots a posterior sample of trees
edge.widthMap

Map continuous trait evolution on the tree
bind.tip

Attaches a new tip to a tree
get.treepos

Get position or node of a plotted tree interactively
Dtest

Conducts correlational D-test from stochastic mapping
ltt

Creates lineage-through-time plot (including extinct lineages)
make.simmap

Simulate stochastic character maps on a phylogenetic tree or trees
add.species.to.genus

Add species to genus on a phylogeny or bind simulated species subtrees to a backbone genus tree
applyBranchLengths

Applies the branch lengths of a reference tree to a target
collapseTree

Interactive tree visualizer
aic.w

Computes AIC weights
make.era.map

Create "era" map on a phylogenetic tree
averageTree

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

Get the sister node number, label, or set of nodes for a node or tip
anoletree

Phylogenetic datasets
add.arrow

Add an arrow pointing to a tip or node on the tree
phyl.RMA

Phylogenetic reduced major axis (RMA) regression
ancThresh

Ancestral character estimation under the threshold model using Bayesian MCMC
phylosig

Compute phylogenetic signal with two methods
cladelabels

Add labels to subtrees of a plotted phylogeny
add.color.bar

Add color bar to a plot
expand.clade

Expands (or contracts) the tip-spacing of a given clade or clades
add.everywhere

Add tip to all edges in a tree
add.random

Add tips at random to the tree
drop.tip.simmap

Drop tips or extract clade from tree with mapped discrete character
compare.chronograms

Compares two chronograms with precisely matching nodes in a visual manner
density.multiSimmap

Computes a posterior distribution for the number and types of changes on the tree
orderMappedEdge

Order the columns of mapped.edge to match across trees
geo.legend

Adds a geological (or other temporal) legend to a plotted tree
cospeciation

Conducts a statistical test of cospeciation between two trees
anc.Bayes

Bayesian ancestral character estimation
countSimmap

Counts the number of character changes on a object of class "simmap" or "multiSimmap"
findMRCA

Get the MRCA of a set of taxa
fastBM

(Reasonably) fast quantitative trait simulation on phylogenies
fit.bd

Fits birth-death (speciation/extinction) model to reconstructed phylogeny
rateshift

Find the temporal position of one or more rate shifts
allFurcTrees

Generate all bi- and multifurcating unrooted trees
drop.tip.contMap

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

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

Conversion to object of class "multiPhylo"
export.as.xml

Export trees & data in XML format
evol.rate.mcmc

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

Plots special types of phylogenetic trees
ls.tree

Least squares branch lengths for a given tree
fitBayes

Evolutionary model fitting with intraspecific variability using Bayesian MCMC
edgeProbs

Compute the relative frequencies of state changes along edges
bind.tree.simmap

Attaches a new tip to a tree
splitplotTree

Plots a phylogeny in two columns
collapse.to.star

Collapse a subtree to a star phylogeny
as.Qmatrix

Convert a fitted Mk model to a Q-matrix
anc.ML

Ancestral character estimation using likelihood
exhaustiveMP

Exhaustive and branch & bound MP optimization
locate.yeti

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

Average the posterior rates
ctt

Generates (or simulates) a 'changes through time' plot from a set of stochastic map character histories
phenogram

Plot phenogram (traitgram)
densityMap

Plot posterior density of stochastic mapping on a tree
brownie.lite

Likelihood test for rate variation in a continuous trait
getCladesofSize

Get all subtrees larger than or equal to a specified size
add.simmap.legend

Add legend to stochastically mapped tree
cophylo

Creates a co-phylogenetic plot
multiC

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

REML version of brownie.lite
genSeq

Simulate a DNA alignment on the tree under a model
fitMk

Fits Mk model
map.to.singleton

Converts a tree without singletons to a tree with singleton nodes
labelnodes

Function to interactively label nodes of a plotted tree
posterior.evolrate

Analysis of the posterior sample from evol.rate.mcmc
likMlambda

Likelihood for joint \(\lambda\)
map.overlap

Proportional overlap between two mapped character histories on a tree
drop.clade

Drop a clade from a tree
getDescendants

Get descendant node numbers
force.ultrametric

Forces a phylogenetic tree to be ultrametric
sim.rates

Brownian or OU simulation with multiple evolutionary regimes
drop.tip.multiPhylo

Drop tip or tips from an object of class "multiPhylo" or "multiSimmap"
ltt95

Creates a (1-\(\alpha\))-percent CI for a set of LTTs
minSplit

Finding the minimum (median) split in the posterior sample
midpoint.root

Midpoint root a phylogeny
print.backbonePhylo

Print method for backbone phylogeny
evol.vcv

Likelihood test for variation in the evolutionary variance-covariance matrix
lambda.transform

\(\lambda\) transformation of matrix
describe.simmap

Summarizes a stochastic mapped tree or set of trees
matchNodes

Matches nodes between two trees
phyl.pairedttest

Phylogenetic paired t-test
reorderSimmap

Reorder edges of a simmap tree
estDiversity

Estimate diversity at each node of the tree
drop.leaves

Drop all the leaves (tips) from a tree
mergeMappedStates

Merge two or more mapped states into one state
linklabels

Function to add tip labels to a plotted tree with linking lines
fastMRCA

Get the MRCA (or height above the root of the MRCA) of a pair of tip taxa
evolvcv.lite

Likelihood test for a shift in the evolutionary correlation between traits
fastAnc

(Reasonably) fast estimation of ML ancestral states
minRotate

Rotates all nodes of the tree to minimize the difference in order with a vector
posthoc

Generic post-hoc test
sim.ratebystate

Conduct simulation of state dependent rate variation
plotTree.errorbars

Plot a tree with error bars around divergence dates
anc.trend

Ancestral character estimation with a trend
simBMphylo

Creates a graphical illustration of Brownian motion evolution on a phylogeny
fitDiversityModel

Fit diversity-dependent phenotypic evolution model
gammatest

Gamma test of Pybus & Harvey (2000)
bmPlot

Simulates and visualizes discrete-time Brownian evolution on a phylogeny
rerootingMethod

Get marginal ancestral state reconstructions by re-rooting
markChanges

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

Get the states at nodes or tips from a mapped tree
branching.diffusion

Animation of branching random diffusion
rep.phylo

Replicate a tree or set of trees
paintSubTree

Paint sub-trees with a discrete character
nodelabels.cophylo

Add labels to a plotted "cophylo" object
getExtant

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

Function to test for correlated evolution of binary traits
di2multi.simmap

Collapse or resolve polytomies in a tree with a character painted on the edges
phylANOVA

Phylogenetic ANOVA and post-hoc tests
mrp.supertree

Matrix representation parsimony supertree estimation
multiRF

Computes Robinson-Foulds distance between a set of trees
multi.mantel

Multiple matrix regression (partial Mantel test)
sampleFrom

Sample from a set of distributions
phyl.pca

Phylogenetic principal components analysis
phylo.to.map

Plot tree with tips linked to geographic coordinates
plotTree

Plots rooted phylogenetic tree
optim.phylo.ls

Phylogeny inference using the least squares method
plot.backbonePhylo

Plots backbone tree with triangles as clades
consensus.edges

Compute consensus edges for a tree under some criterion
plotBranchbyTrait

Plot branch colors by a quantitative trait or value
phylo.heatmap

Creates a phylogenetic heat map
ladderize.simmap

Ladderize a tree with a mapped discrete character
mapped.states

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

Write a tree to file in Nexus format
vcvPhylo

Calculates cophenetic (i.e., phylogenetic VCV) matrix
reorder.backbonePhylo

Reorders a backbone phylogeny
pgls.Ives

Phylogenetic regression with intraspecific sampling error
setMap

Set color map for various phylogenetic objects of classes
contMap

Map continuous trait evolution on the tree
sim.history

Simulate character history or a discrete character at the tips of the tree under some model
ratebystate

Method for investigating the rate of one trait as a function of the state of another
locate.fossil

Locate a fossil lineage in a tree using continuous characters
phylomorphospace

Creates phylomorphospace plot
phyl.cca

Phylogenetic canonical correlation analysis
roundBranches

Rounds the branch lengths of a tree
phylomorphospace3d

Creates tree-dimensional phylomorphospace plot
rescaleSimmap

Rescale SIMMAP style tree
threshState

Computes value for a threshold character from a liability and thresholds
paste.tree

Paste two trees together
plotTree.wBars

Plot a tree with bars at the tips
pbtree

Simulate pure-birth or birth-death stochastic tree or trees
dotTree

Creates a phylogenetic dot plot
phyl.resid

Phylogenetic size-correction via GLS regression
phyl.vcv

Compute evolutionary VCV matrix for a tree & dataset
untangle

Attempts to untangle crossing branches for plotting
nodeHeights

Compute the heights above the root of each node
reroot

Re-root a tree along an edge
read.newick

Newick or Nexus style tree reader
sim.corrs

Multivariate Brownian simulation with multiple correlations and rates
multirateBM

Function to fit a multi-rate Brownian evolution model
splitEdgeColor

Split edge colors when descendant edges have different mapped states
rstate

Pick a random state according to a vector of probabilities
phytools-package

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

Compute design matrix for least squares analyses
modified.Grafen

Computes modified Grafen edge lengths
skewers

Matrix comparison using the method of random skewers
to.matrix

Convert a character vector to a binary matrix
phylo.impute

Phylogenetic imputation for multivariate continuous character data
threshDIC

Deviance Information Criterion from the threshold model
phylo.toBackbone

Converts tree to backbone or vice versa
plotTree.datamatrix

Plot a tree with a discrete character data matrix at the tips
starTree

Create star phylogeny
threshBayes

Threshold model using Bayesian MCMC
ratebytree

Likelihood test for rate variation among trees, clades, or traits
roundPhylogram

Plot a round or sigmoidal phylogram or cladogram
plotSimmap

Plot stochastic character mapped tree
write.simmap

Write a stochastic character mapped tree to file
plotThresh

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

Split tree at a point
read.simmap

Read SIMMAP style trees from file
resolveNode

Compute all possible resolutions of a node or all nodes in a multifurcating tree
rotateNodes

Rotates a node or set of nodes in a phylogenetic tree
tree.grow

Creates an animation of a tree growing from left-to-right or upwards
treeSlice

Slices the tree at a particular point and returns all subtrees, or the tree rootward of the point
strahlerNumber

Computes Strahler number for trees and nodes
writeAncestors

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