Learn R Programming

TreeTools (version 1.14.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,855

Version

1.14.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

May 13th, 2025

Functions in TreeTools (1.14.0)

DescendantEdges

Identify descendant edges
Decompose

Decompose additive (ordered) phylogenetic characters
DoubleFactorial

Double factorial
DropTip

Drop leaves from tree
ConsensusWithout

Reduced consensus, omitting specified taxa
ConstrainedNJ

Constrained neighbour-joining tree
Consensus

Construct consensus trees
CompatibleSplits

Which splits are compatible?
EdgeAncestry

Ancestors of an edge
EdgeDistances

Distance between edges
Hamming

Hamming distance between taxa in a phylogenetic dataset
J1Index

Robust universal tree balance index
EndSentence

Add full stop to end of a sentence
ExtractTaxa

Extract taxa from a matrix block
KeptVerts

Identify vertices retained when leaves are dropped
GenerateTree

Generate pectinate, balanced or random trees
LabelSplits

Label splits
KeptPaths

Paths present in reduced tree
ImposeConstraint

Force a tree to match a constraint
MSTEdges

Minimum spanning tree
N1Spr

Number of trees one SPR step away
MorphoBankDecode

Decode MorphoBank text
EnforceOutgroup

Generate a tree with a specified outgroup
MatchEdges

Match nodes and edges between trees
NDescendants

Count descendants for each node in a tree
NJTree

Generate a neighbour joining tree
MakeTreeBinary

Generate binary tree by collapsing polytomies
NTip

Number of leaves in a phylogenetic tree
LeafLabelInterchange

Leaf label interchange
ListAncestors

List ancestors
NSplits

Number of distinct splits
Renumber

Renumber a tree's nodes and tips
RenumberTips

Renumber a tree's tips
NodeOrder

Number of edges incident to each node in a tree
PathLengths

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

Distances between each pair of trees
StringToPhyDat

Convert between strings and phyDat objects
NewickTree

Write Newick Tree
MRCA

Most recent common ancestor
ReadCharacters

Read phylogenetic characters from file
PolarizeSplits

Polarize splits on a single taxon
Neworder

Reorder edges of a phylogenetic tree
RootNode

Which node is a tree's root?
RoguePlot

Visualize position of rogue taxa
Lobo.data

Data from Zhang et al. 2016
NodeNumbers

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

Phylogenetic information content of splitting leaves into two partitions
SplitFrequency

Frequency of splits
NodeDepth

Distance of each node from tree exterior
MatrixToPhyDat

Convert between matrices and phyDat objects
RenumberTree

Reorder tree edges and nodes
RightmostCharacter

Rightmost character of string
SortTree

Sort tree
SpectrumLegend

Produce a legend for continuous gradient scales
Subsplit

Subset of a split on fewer leaves
SplitsInBinaryTree

Maximum splits in an n-leaf tree
TipTimedTree

Display time-calibrated tree using tip information only
TipsInSplits

Tips contained within splits
NPartitionPairs

Distributions of tips consistent with a partition pair
NRooted

Number of trees
SplitMatchProbability

Probability of matching this well
TrivialSplits

Identify and remove trivial splits
Splits

Convert object to Splits
TrivialTree

Generate trivial trees
Subtree

Extract a subtree
TreesMatchingTree

Number of trees containing a tree
ReadTntTree

Parse TNT Tree
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
brewer

Brewer palettes
.RandomParent

Random parent vector
TreesMatchingSplit

Number of trees matching a bipartition split
RootTree

Root or unroot a phylogenetic tree
SampleOne

Select element at random
xor

Exclusive OR operation
TreeNumber

Unique integer indices for bifurcating tree topologies
UnshiftTree

Add tree to start of list
TreeIsRooted

Is tree rooted?
doubleFactorials

Double factorials
sort.multiPhylo

Sort a list of phylogenetic trees
edge_to_splits

Efficiently convert edge matrix to splits
WriteTntCharacters

Write morphological character matrix to TNT file
is.TreeNumber

Is an object a TreeNumber object?
print.TreeNumber

Print TreeNumber object
nRootedShapes

Number of rooted / unrooted tree shapes
logDoubleFactorials

Natural logarithms of double factorials
TipLabels

Extract tip labels
SupportColour

Colour for node support value
Stemwardness

"Stemwardness" of a leaf
UnrootedTreesMatchingSplit

Number of trees consistent with split
TopologyOnly

Remove metadata from trees
Unquote

Remove quotation marks from a string
TotalCopheneticIndex

Total Cophenetic Index
unrootedKeys

Integer representing shape of a tree
as.Newick

Write a phylogenetic tree in Newick format
TreeTools-package

TreeTools
sapply64

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

Convert object to multiPhylo class
root_on_node

Wrapper for internal C function root_on_node()
match,phylo,phylo-method

Tree matching
match,Splits,Splits-method

Split matching
ArtificialExtinction

Artificial Extinction
ApeTime

Read modification time from "ape" Nexus file
CladeSizes

Clade sizes
CollapseNode

Collapse nodes on a phylogenetic tree
ClusterTable

Convert phylogenetic tree to ClusterTable
AncestorEdge

Ancestral edge
ClusterTable-methods

S3 methods for ClusterTable objects
CladisticInfo

Cladistic information content of a tree
CharacterInformation

Character information content
AddTip

Add a tip to a phylogenetic tree