Learn R Programming

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

1,384

Version

1.13.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Martin R. Smith

Last Published

April 7th, 2025

Functions in TreeTools (1.13.1)

CompatibleSplits

Which splits are compatible?
DoubleFactorial

Double factorial
EdgeAncestry

Ancestors of an edge
EnforceOutgroup

Generate a tree with a specified outgroup
Hamming

Hamming distance between taxa in a phylogenetic dataset
EndSentence

Add full stop to end of a sentence
KeptPaths

Paths present in reduced tree
KeptVerts

Identify vertices retained when leaves are dropped
J1Index

Robust universal tree balance index
ImposeConstraint

Force a tree to match a constraint
ExtractTaxa

Extract taxa from a matrix block
GenerateTree

Generate pectinate, balanced or random trees
LabelSplits

Label splits
MorphoBankDecode

Decode MorphoBank text
Lobo.data

Data from Zhang et al. 2016
LeafLabelInterchange

Leaf label interchange
N1Spr

Number of trees one SPR step away
ListAncestors

List ancestors
MRCA

Most recent common ancestor
MakeTreeBinary

Generate binary tree by collapsing polytomies
MatchEdges

Match nodes and edges between trees
MatrixToPhyDat

Convert between matrices and phyDat objects
MSTEdges

Minimum spanning tree
NewickTree

Write Newick Tree
Neworder

Reorder edges of a phylogenetic tree
NodeNumbers

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

Generate a neighbour joining tree
NTip

Number of leaves in a phylogenetic tree
NDescendants

Count descendants for each node in a tree
NSplits

Number of distinct splits
NPartitionPairs

Distributions of tips consistent with a partition pair
NodeDepth

Distance of each node from tree exterior
NRooted

Number of trees
RenumberTips

Renumber a tree's tips
ReadMrBayesTrees

Read posterior tree sample produced by MrBayes
NodeOrder

Number of edges incident to each node in a tree
Renumber

Renumber a tree's nodes and tips
StringToPhyDat

Convert between strings and phyDat objects
PairwiseDistances

Distances between each pair of trees
PathLengths

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

Read phylogenetic characters from file
ReadTntTree

Parse TNT Tree
PolarizeSplits

Polarize splits on a single taxon
SplitFrequency

Frequency of splits
RenumberTree

Reorder tree edges and nodes
RoguePlot

Visualize position of rogue taxa
RootNode

Which node is a tree's root?
SpectrumLegend

Produce a legend for continuous gradient scales
SortTree

Sort tree
RootTree

Root or unroot a phylogenetic tree
RightmostCharacter

Rightmost character of string
SampleOne

Select element at random
SplitInformation

Phylogenetic information content of splitting leaves into two partitions
Subsplit

Subset of a split on fewer leaves
Stemwardness

"Stemwardness" of a leaf
SplitsInBinaryTree

Maximum splits in an n-leaf tree
TipLabels

Extract tip labels
Subtree

Extract a subtree
SupportColour

Colour for node support value
Splits

Convert object to Splits
TipsInSplits

Tips contained within splits
SplitMatchProbability

Probability of matching this well
TipTimedTree

Display time-calibrated tree using tip information only
TreeTools-package

TreeTools
TopologyOnly

Remove metadata from trees
TrivialTree

Generate trivial trees
TreeNumber

Unique integer indices for bifurcating tree topologies
TrivialSplits

Identify and remove trivial splits
TreeIsRooted

Is tree rooted?
TreesMatchingSplit

Number of trees matching a bipartition split
TreesMatchingTree

Number of trees containing a tree
TotalCopheneticIndex

Total Cophenetic Index
unrootedKeys

Integer representing shape of a tree
brewer

Brewer palettes
as.Newick

Write a phylogenetic tree in Newick format
Unquote

Remove quotation marks from a string
doubleFactorials

Double factorials
.RandomParent

Random parent vector
edge_to_splits

Efficiently convert edge matrix to splits
UnrootedTreesMatchingSplit

Number of trees consistent with split
UnshiftTree

Add tree to start of list
WriteTntCharacters

Write morphological character matrix to TNT file
as.multiPhylo

Convert object to multiPhylo class
nRootedShapes

Number of rooted / unrooted tree shapes
is.TreeNumber

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

Split matching
sort.multiPhylo

Sort a list of phylogenetic trees
sapply64

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

Exclusive OR operation
print.TreeNumber

Print TreeNumber object
root_on_node

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

Tree matching
logDoubleFactorials

Natural logarithms of double factorials
CladisticInfo

Cladistic information content of a tree
ApeTime

Read modification time from "ape" Nexus file
ClusterTable-methods

S3 methods for ClusterTable objects
ClusterTable

Convert phylogenetic tree to ClusterTable
AddTip

Add a tip to a phylogenetic tree
CollapseNode

Collapse nodes on a phylogenetic tree
Decompose

Decompose additive (ordered) phylogenetic characters
AncestorEdge

Ancestral edge
CharacterInformation

Character information content
Consensus

Construct consensus trees
CladeSizes

Clade sizes
ConsensusWithout

Reduced consensus, omitting specified taxa
DescendantEdges

Identify descendant edges
ArtificialExtinction

Artificial Extinction
EdgeDistances

Distance between edges
DropTip

Drop leaves from tree
ConstrainedNJ

Constrained neighbour-joining tree