Learn R Programming

TreeTools (version 1.16.1)

Create, Modify and Analyse Phylogenetic Trees

Description

Efficient implementations of functions for the creation, modification and analysis of phylogenetic trees. Applications include: generation of trees with specified shapes; tree rearrangement; analysis of tree shape; rooting of trees and extraction of subtrees; calculation and depiction of split support; plotting the position of rogue taxa (Klopfstein & Spasojevic 2019) ; calculation of ancestor-descendant relationships, of 'stemwardness' (Asher & Smith, 2022) , and of tree balance (Mir et al. 2013, Lemant et al. 2022) , ; artificial extinction (Asher & Smith, 2022) ; import and export of trees from Newick, Nexus (Maddison et al. 1997) , and TNT formats; and analysis of splits and cladistic information.

Copy Link

Version

Install

install.packages('TreeTools')

Monthly Downloads

2,405

Version

1.16.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

August 24th, 2025

Functions in TreeTools (1.16.1)

EdgeAncestry

Ancestors of an edge
Decompose

Decompose additive (ordered) phylogenetic characters
DoubleFactorial

Double factorial
DropTip

Drop leaves from tree
Consensus

Construct consensus trees
ConstrainedNJ

Constrained neighbour-joining tree
EdgeDistances

Distance between edges
ConsensusWithout

Reduced consensus, omitting specified taxa
CompatibleSplits

Which splits are compatible?
DescendantEdges

Identify descendant edges
EnforceOutgroup

Generate a tree with a specified outgroup
KeptVerts

Identify vertices retained when leaves are dropped
EndSentence

Add full stop to end of a sentence
Hamming

Hamming distance between taxa in a phylogenetic dataset
LabelSplits

Label splits
KeptPaths

Paths present in reduced tree
J1Index

Robust universal tree balance index
ExtractTaxa

Extract taxa from a matrix block
ImposeConstraint

Force a tree to match a constraint
GenerateTree

Generate pectinate, balanced or random trees
MatrixToPhyDat

Convert between matrices and phyDat objects
Lobo.data

Data from Zhang et al. 2016
MSTEdges

Minimum spanning tree
ListAncestors

List ancestors
MRCA

Most recent common ancestor
MatchEdges

Match nodes and edges between trees
MatchStrings

Check for mismatch between character vectors
LongBranch

Identify taxa with long branches
LeafLabelInterchange

Leaf label interchange
MakeTreeBinary

Generate binary tree by collapsing polytomies
NewickTree

Write Newick Tree
MorphoBankDecode

Decode MorphoBank text
N1Spr

Number of trees one SPR step away
NRooted

Number of trees
Neworder

Reorder edges of a phylogenetic tree
NSplits

Number of distinct splits
NDescendants

Count descendants for each node in a tree
NTip

Number of leaves in a phylogenetic tree
NPartitionPairs

Distributions of tips consistent with a partition pair
NJTree

Generate a neighbour joining tree
PairwiseDistances

Distances between each pair of trees
NodeDepth

Distance of each node from tree exterior
NodeOrder

Number of edges incident to each node in a tree
ReadTntTree

Parse TNT Tree
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
ReadCharacters

Read phylogenetic characters from file
StringToPhyDat

Convert between strings and phyDat objects
PolarizeSplits

Polarize splits on a single taxon
PathLengths

Calculate length of paths between each pair of vertices within tree
NodeNumbers

Numeric index of each node in a tree NodeNumbers() returns a sequence corresponding to the nodes in a tree
Renumber

Renumber a tree's nodes and tips
RootNode

Which node is a tree's root?
RenumberTips

Renumber a tree's tips
RootTree

Root or unroot a phylogenetic tree
SortTree

Sort tree
RoguePlot

Visualize position of rogue taxa
RenumberTree

Reorder tree edges and nodes
SampleOne

Select element at random
RightmostCharacter

Rightmost character of string
Reweight

Reweight phylogenetic characters
SplitsInBinaryTree

Maximum splits in an n-leaf tree
Subtree

Extract a subtree
SpectrumLegend

Produce a legend for continuous gradient scales
SplitFrequency

Frequency of splits
Splits

Convert object to Splits
SplitInformation

Phylogenetic information content of splitting leaves into two partitions
Stemwardness

"Stemwardness" of a leaf
SplitMatchProbability

Probability of matching this well
SplitConsistent

Identify consistent / conflicting splits
Subsplit

Subset of a split on fewer leaves
SupportColour

Colour for node support value
TipsInSplits

Tips contained within splits
TreeIsRooted

Is tree rooted?
TreeTools-package

TreeTools
TreeNumber

Unique integer indices for bifurcating tree topologies
TipTimedTree

Display time-calibrated tree using tip information only
TotalCopheneticIndex

Total Cophenetic Index
TopologyOnly

Remove metadata from trees
TipLabels

Extract tip labels
unrootedKeys

Integer representing shape of a tree
WriteTntCharacters

Write morphological character matrix to TNT file
as.Newick

Write a phylogenetic tree in Newick format
Unquote

Remove quotation marks from a string
TrivialSplits

Identify and remove trivial splits
Treeness

Relative length of internal branches
UnshiftTree

Add tree to start of list
UnrootedTreesMatchingSplit

Number of trees consistent with split
TrivialTree

Generate trivial trees
TreesMatchingTree

Number of trees containing a tree
TreesMatchingSplit

Number of trees matching a bipartition split
edge_to_splits

Efficiently convert edge matrix to splits
is.TreeNumber

Is an object a TreeNumber object?
as.multiPhylo

Convert object to multiPhylo class
.RandomParent

Random parent vector
match,Splits,Splits-method

Split matching
match,phylo,phylo-method

Tree matching
brewer

Brewer palettes
doubleFactorials

Double factorials
nRootedShapes

Number of rooted / unrooted tree shapes
sapply64

Apply a function that returns 64-bit integers over a list or vector
sort.multiPhylo

Sort a list of phylogenetic trees
xor

Exclusive OR operation
print.TreeNumber

Print TreeNumber object
logDoubleFactorials

Natural logarithms of double factorials
root_on_node

Wrapper for internal C function root_on_node()
CharacterInformation

Character information content
ClusterTable

Convert phylogenetic tree to ClusterTable
ApeTime

Read modification time from "ape" Nexus file
AncestorEdge

Ancestral edge
CladeSizes

Clade sizes
CollapseNode

Collapse nodes on a phylogenetic tree
CladisticInfo

Cladistic information content of a tree
ArtificialExtinction

Artificial Extinction
ClusterTable-methods

S3 methods for ClusterTable objects
AddTip

Add a tip to a phylogenetic tree