Learn R Programming

TreeTools (version 2.1.0)

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

1,999

Version

2.1.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

February 11th, 2026

Functions in TreeTools (2.1.0)

CharacterInformation

Character information content
MatchEdges

Match nodes and edges between trees
NPartitionPairs

Distributions of tips consistent with a partition pair
NRooted

Number of trees
NSplits

Number of distinct splits
Neworder

Reorder edges of a phylogenetic tree
NewickTree

Write Newick Tree
MorphoBankDecode

Decode MorphoBank text
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
N1Spr

Number of trees one SPR step away
NTip

Number of leaves in a phylogenetic tree
NodeOrder

Number of edges incident to each node in a tree
PolarizeSplits

Polarize splits on a single taxon
NDescendants

Count descendants for each node in a tree
ReadCharacters

Read phylogenetic characters from file
NJTree

Generate a neighbour joining tree
PairwiseDistances

Distances between each pair of trees
ReadTntTree

Parse TNT Tree
NodeNumbers

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

Distance of each node from tree exterior
PathLengths

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

Convert between strings and phyDat objects
RightmostCharacter

Rightmost character of string
RootTree

Root or unroot a phylogenetic tree
RoguePlot

Visualize position of rogue taxa
SortTree

Sort tree
RenumberTips

Renumber a tree's tips
SampleOne

Select element at random
RootNode

Which node is a tree's root?
Renumber

Renumber a tree's nodes and tips
RenumberTree

Reorder tree edges and nodes
Reweight

Reweight phylogenetic characters
SplitsInBinaryTree

Maximum splits in an n-leaf tree
Splits

Convert object to Splits
Subsplit

Subset of a split on fewer leaves
SplitInformation

Phylogenetic information content of splitting leaves into two partitions
SplitMatchProbability

Probability of matching this well
SplitConsistent

Identify consistent / conflicting splits
Stemwardness

"Stemwardness" of a leaf
Subtree

Extract a subtree
SupportColour

Colour for node support value
SplitFrequency

Frequency of splits
TreeNumber

Unique integer indices for bifurcating tree topologies
TotalCopheneticIndex

Total Cophenetic Index
TipLabels

Extract tip labels
TipsInSplits

Tips contained within splits
TipTimedTree

Display time-calibrated tree using tip information only
Treeness

Relative length of internal branches
TopologyOnly

Remove metadata from trees
TreeIsRooted

Is tree rooted?
TreeTools-package

TreeTools
unrootedKeys

Integer representing shape of a tree
Unquote

Remove quotation marks from a string
UnrootedTreesMatchingSplit

Number of trees consistent with split
as.Newick

Write a phylogenetic tree in Newick format
TrivialTree

Generate trivial trees
TrivialSplits

Identify and remove trivial splits
UnshiftTree

Add tree to start of list
TreesMatchingSplit

Number of trees matching a bipartition split
as.multiPhylo

Convert object to multiPhylo class
WriteTntCharacters

Write morphological character matrix to TNT file
TreesMatchingTree

Number of trees containing a tree
is.TreeNumber

Is an object a TreeNumber object?
match,Splits,Splits-method

Split matching
print.TreeNumber

Print TreeNumber object
edge_to_splits

Efficiently convert edge matrix to splits
logDoubleFactorials

Natural logarithms of double factorials
match,phylo,phylo-method

Tree matching
brewer

Brewer palettes
doubleFactorials

Double factorials
nRootedShapes

Number of rooted / unrooted tree shapes
.RandomParent

Random parent vector
xor

Exclusive OR operation
sapply64

Apply a function that returns 64-bit integers over a list or vector
root_on_node

Wrapper for internal C function root_on_node()
sort.multiPhylo

Sort a list of phylogenetic trees
Cherries

Count cherries in a tree
ClusterTable

Convert phylogenetic tree to ClusterTable
AncestorEdge

Ancestral edge
ClusterTable-methods

S3 methods for ClusterTable objects
ApeTime

Read modification time from "ape" Nexus file
ArtificialExtinction

Artificial Extinction
CladeSizes

Clade sizes
CladisticInfo

Cladistic information content of a tree
Consensus

Construct consensus trees
AddTip

Add a tip to a phylogenetic tree
DoubleFactorial

Double factorial
DescendantEdges

Identify descendant edges
CollapseNode

Collapse nodes on a phylogenetic tree
Decompose

Decompose additive (ordered) phylogenetic characters
DropTip

Drop leaves from tree
ConsensusWithout

Reduced consensus, omitting specified taxa
ConstrainedNJ

Constrained neighbour-joining tree
EdgeAncestry

Ancestors of an edge
CompatibleSplits

Which splits are compatible?
KeptVerts

Identify vertices retained when leaves are dropped
J1Index

Robust universal tree balance index
KeptPaths

Paths present in reduced tree
ImposeConstraint

Force a tree to match a constraint
Hamming

Hamming distance between taxa in a phylogenetic dataset
EndSentence

Add full stop to end of a sentence
EdgeDistances

Distance between edges
LongBranch

Identify taxa with long branches
MakeTreeBinary

Generate binary tree by collapsing polytomies
Lobo.data

Data from Zhang et al. 2016
MRCA

Most recent common ancestor
MSTEdges

Minimum spanning tree
LabelSplits

Label splits
ListAncestors

List ancestors
LeafLabelInterchange

Leaf label interchange
GenerateTree

Generate pectinate, balanced or random trees
ExtractTaxa

Extract taxa from a matrix block
MatchStrings

Check for mismatch between character vectors
MatrixToPhyDat

Convert between matrices and phyDat objects