Learn R Programming

TreeTools (version 2.0.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

7,875

Version

2.0.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

September 23rd, 2025

Functions in TreeTools (2.0.0)

Decompose

Decompose additive (ordered) phylogenetic characters
Consensus

Construct consensus trees
ConsensusWithout

Reduced consensus, omitting specified taxa
GenerateTree

Generate pectinate, balanced or random trees
ExtractTaxa

Extract taxa from a matrix block
KeptPaths

Paths present in reduced tree
MSTEdges

Minimum spanning tree
MRCA

Most recent common ancestor
MakeTreeBinary

Generate binary tree by collapsing polytomies
LabelSplits

Label splits
NSplits

Number of distinct splits
MatchEdges

Match nodes and edges between trees
NTip

Number of leaves in a phylogenetic tree
KeptVerts

Identify vertices retained when leaves are dropped
ImposeConstraint

Force a tree to match a constraint
MatrixToPhyDat

Convert between matrices and phyDat objects
MatchStrings

Check for mismatch between character vectors
Neworder

Reorder edges of a phylogenetic tree
NewickTree

Write Newick Tree
NPartitionPairs

Distributions of tips consistent with a partition pair
N1Spr

Number of trees one SPR step away
MorphoBankDecode

Decode MorphoBank text
LeafLabelInterchange

Leaf label interchange
ListAncestors

List ancestors
NDescendants

Count descendants for each node in a tree
EndSentence

Add full stop to end of a sentence
Lobo.data

Data from Zhang et al. 2016
EdgeDistances

Distance between edges
PairwiseDistances

Distances between each pair of trees
NodeOrder

Number of edges incident to each node in a tree
NJTree

Generate a neighbour joining tree
PathLengths

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

Polarize splits on a single taxon
ReadCharacters

Read phylogenetic characters from file
ReadTntTree

Parse TNT Tree
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
LongBranch

Identify taxa with long branches
StringToPhyDat

Convert between strings and phyDat objects
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
NRooted

Number of trees
RenumberTips

Renumber a tree's tips
RoguePlot

Visualize position of rogue taxa
RootNode

Which node is a tree's root?
SampleOne

Select element at random
RightmostCharacter

Rightmost character of string
SortTree

Sort tree
RenumberTree

Reorder tree edges and nodes
RootTree

Root or unroot a phylogenetic tree
Renumber

Renumber a tree's nodes and tips
Reweight

Reweight phylogenetic characters
Splits

Convert object to Splits
Subtree

Extract a subtree
SplitsInBinaryTree

Maximum splits in an n-leaf tree
Stemwardness

"Stemwardness" of a leaf
SplitConsistent

Identify consistent / conflicting splits
SupportColour

Colour for node support value
SplitFrequency

Frequency of splits
SplitMatchProbability

Probability of matching this well
SplitInformation

Phylogenetic information content of splitting leaves into two partitions
TreeNumber

Unique integer indices for bifurcating tree topologies
unrootedKeys

Integer representing shape of a tree
UnshiftTree

Add tree to start of list
Treeness

Relative length of internal branches
WriteTntCharacters

Write morphological character matrix to TNT file
TreeTools-package

TreeTools
TrivialSplits

Identify and remove trivial splits
as.multiPhylo

Convert object to multiPhylo class
TreeIsRooted

Is tree rooted?
TotalCopheneticIndex

Total Cophenetic Index
as.Newick

Write a phylogenetic tree in Newick format
TrivialTree

Generate trivial trees
.RandomParent

Random parent vector
match,Splits,Splits-method

Split matching
match,phylo,phylo-method

Tree matching
brewer

Brewer palettes
is.TreeNumber

Is an object a TreeNumber object?
Subsplit

Subset of a split on fewer leaves
TipsInSplits

Tips contained within splits
logDoubleFactorials

Natural logarithms of double factorials
TopologyOnly

Remove metadata from trees
Unquote

Remove quotation marks from a string
nRootedShapes

Number of rooted / unrooted tree shapes
TreesMatchingTree

Number of trees containing a tree
TreesMatchingSplit

Number of trees matching a bipartition split
TipLabels

Extract tip labels
root_on_node

Wrapper for internal C function root_on_node()
sapply64

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

Display time-calibrated tree using tip information only
doubleFactorials

Double factorials
print.TreeNumber

Print TreeNumber object
sort.multiPhylo

Sort a list of phylogenetic trees
edge_to_splits

Efficiently convert edge matrix to splits
UnrootedTreesMatchingSplit

Number of trees consistent with split
xor

Exclusive OR operation
CharacterInformation

Character information content
ClusterTable-methods

S3 methods for ClusterTable objects
CladisticInfo

Cladistic information content of a tree
ArtificialExtinction

Artificial Extinction
CladeSizes

Clade sizes
ApeTime

Read modification time from "ape" Nexus file
Cherries

Count cherries in a tree
AddTip

Add a tip to a phylogenetic tree
ClusterTable

Convert phylogenetic tree to ClusterTable
EdgeAncestry

Ancestors of an edge
DoubleFactorial

Double factorial
ConstrainedNJ

Constrained neighbour-joining tree
DropTip

Drop leaves from tree
DescendantEdges

Identify descendant edges
CollapseNode

Collapse nodes on a phylogenetic tree
CompatibleSplits

Which splits are compatible?
AncestorEdge

Ancestral edge
J1Index

Robust universal tree balance index
Hamming

Hamming distance between taxa in a phylogenetic dataset