Learn R Programming

TreeTools (version 2.4.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,387

Version

2.4.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

September 10th, 2026

Functions in TreeTools (2.4.1)

GenerateTree

Generate pectinate, balanced or random trees
EndSentence

Add full stop to end of a sentence
ImposeConstraint

Force a tree to match a constraint
EdgeRatio

Ratio of external:internal edge length
Hamming

Hamming distance between taxa in a phylogenetic dataset
KeptPaths

Paths present in reduced tree
EdgeDistances

Distance between edges
ExtractTaxa

Extract taxa from a matrix block
J1Index

Robust universal tree balance index
KeptVerts

Identify vertices retained when leaves are dropped
MakeTreeBinary

Generate binary tree by collapsing polytomies
LeafLabelInterchange

Leaf label interchange
MRCA

Most recent common ancestor
ListAncestors

List ancestors
MSTEdges

Minimum spanning tree
LongBranch

Identify taxa with long branches
LabelSplits

Label splits
Lobo.data

Data from Zhang et al. 2016
MatchEdges

Match nodes and edges between trees
MatchStrings

Check for mismatch between character vectors
NJTree

Generate a neighbour joining tree
MatrixToPhyDat

Convert between matrices and phyDat objects
NDescendants

Count descendants for each node in a tree
NewickTree

Write Newick Tree
NTip

Number of leaves in a phylogenetic tree
NSplits

Number of distinct splits
NPartitionPairs

Distributions of tips consistent with a partition pair
NRooted

Number of trees
MorphoBankDecode

Decode MorphoBank text
N1Spr

Number of trees one SPR step away
NexusTokensToInteger

Convert Nexus token matrix to integer
PairwiseDistances

Distances between each pair of trees
PathLengths

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

Number of edges incident to each node in a tree
PaintTree

Colour a tree by topology
PolarizeSplits

Polarize splits on a single taxon
NodeDepth

Distance of each node from tree exterior
NodeNumbers

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

Convert between strings and phyDat objects
Neworder

Reorder edges of a phylogenetic tree
ReadCharacters

Read phylogenetic characters from file
Renumber

Renumber a tree's nodes and tips
RenumberTips

Renumber a tree's tips
RoguePlot

Visualize position of rogue taxa
Reweight

Re-weight phylogenetic characters
RootNode

Which node is a tree's root?
RenumberTree

Reorder tree edges and nodes
RightmostCharacter

Rightmost character of string
ReadTntTree

Parse TNT Tree
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
SplitMatchProbability

Probability of matching this well
SplitConsistent

Identify consistent / conflicting splits
SplitsInBinaryTree

Maximum splits in an n-leaf tree
Splits

Convert object to Splits
SortTree

Sort tree
SplitFrequency

Frequency of splits
SplitInformation

Phylogenetic information content of splitting leaves into two partitions
RootTree

Root or unroot a phylogenetic tree
Stemwardness

"Stemwardness" of a leaf
SampleOne

Select element at random
TreeIsRooted

Is tree rooted?
TipsInSplits

Tips contained within splits
TipLabels

Extract tip labels
SupportColour

Colour for node support value
TipTimedTree

Display time-calibrated tree using tip information only
TopologyOnly

Remove metadata from trees
TotalCopheneticIndex

Total Cophenetic Index
Subtree

Extract a subtree
Subsplit

Subset of a split on fewer leaves
TreeNumber

Unique integer indices for bifurcating tree topologies
UnrootedTreesMatchingSplit

Number of trees consistent with split
Treeness

Relative length of internal branches
Unquote

Remove quotation marks from a string
TrivialSplits

Identify and remove trivial splits
UnshiftTree

Add tree to start of list
TreesMatchingTree

Number of trees containing a tree
unrootedKeys

Integer representing shape of a tree
TreesMatchingSplit

Number of trees matching a bipartition split
TreeTools-package

TreeTools
TrivialTree

Generate trivial trees
edge_to_splits

Efficiently convert edge matrix to splits
is.TreeNumber

Is an object a TreeNumber object?
as.multiPhylo

Convert object to multiPhylo class
as.Newick

Write a phylogenetic tree in Newick format
WriteTntCharacters

Write morphological character matrix to TNT file
doubleFactorials

Double factorials
.RandomParent

Random parent vector
brewer

Brewer palettes
logDoubleFactorials

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

Split matching
sapply64

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

Sort a list of phylogenetic trees
root_on_node

Wrapper for internal C function root_on_node()
print.TreeNumber

Print TreeNumber object
xor

Exclusive OR operation
nRootedShapes

Number of rooted / unrooted tree shapes
match,phylo,phylo-method

Tree matching
ApeTime

Read modification time from "ape" Nexus file
Cherries

Count cherries in a tree
CladisticInfo

Cladistic information content of a tree
AncestorEdge

Ancestral edge
ArtificialExtinction

Artificial Extinction
ClusterTable-methods

S3 methods for ClusterTable objects
ClusterTable

Convert phylogenetic tree to ClusterTable
CladeSizes

Clade sizes
CharacterInformation

Character information content
DoubleFactorial

Double factorial
DescendantEdges

Identify descendant edges
Decompose

Decompose additive (ordered) phylogenetic characters
DropTip

Drop leaves from tree
ConsensusWithout

Reduced consensus, omitting specified taxa
Consensus

Construct consensus trees
AddTip

Add a tip to a phylogenetic tree
EdgeAncestry

Ancestors of an edge
ConstrainedNJ

Constrained neighbour-joining tree
CollapseNode

Collapse nodes on a phylogenetic tree
CompatibleSplits

Which splits are compatible?