Skip to contents

Tree manipulation

Functions for editing phylogenetic trees.

AddTip() AddTipEverywhere()
Add a tip to a phylogenetic tree
CollapseNode() CollapseEdge()
Collapse nodes on a phylogenetic tree
ConsensusWithout() MarkMissing()
Reduced consensus, omitting specified taxa
DropTip() DropTipPhylo() KeepTipPreorder() KeepTipPostorder() KeepTip()
Drop leaves from tree
EnforceOutgroup()
Generate a tree with a specified outgroup
ImposeConstraint() AddUnconstrained()
Force a tree to match a constraint
KeptPaths()
Paths present in reduced tree
KeptVerts()
Identify vertices retained when leaves are dropped
LeafLabelInterchange()
Leaf label interchange
MakeTreeBinary()
Generate binary tree by collapsing polytomies
Renumber()
Renumber a tree's nodes and tips
RenumberTips()
Renumber a tree's tips
RootTree() RootOnNode() UnrootTree()
Root or unroot a phylogenetic tree
SortTree()
Sort tree
Subtree()
Extract a subtree
TipTimedTree()
Display time-calibrated tree using tip information only
SingleTaxonTree() ZeroTaxonTree()
Generate trivial trees

Tree navigation

Functions to navigate phylogenetic trees.

CladeSizes()
Clade sizes
DescendantEdges() DescendantTips() AllDescendantEdges()
Identify descendant edges
EdgeAncestry()
Ancestors of an edge
EdgeDistances()
Distance between edges
ListAncestors() AllAncestors()
List ancestors
MRCA()
Most recent common ancestor
MatchEdges() MatchNodes()
Match nodes and edges between trees
NDescendants()
Count descendants for each node in a tree
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
NodeOrder()
Number of edges incident to each node in a tree
RootNode()
Which node is a tree's root?

Tree creation

Functions to generate phylogenetic trees.

ConstrainedNJ()
Constrained neighbour-joining tree
RandomTree() YuleTree() PectinateTree() BalancedTree() StarTree()
Generate pectinate, balanced or random trees
NJTree()
Generate a neighbour joining tree
as.TreeNumber() as.phylo(<numeric>) as.phylo(<TreeNumber>) as.MixedBase() as.phylo(<MixedBase>)
Unique integer indices for bifurcating tree topologies
SingleTaxonTree() ZeroTaxonTree()
Generate trivial trees
is.TreeNumber()
Is an object a TreeNumber object?
print(<TreeNumber>)
Print TreeNumber object

Tree properties

Functions describing properties of trees.

CladisticInfo() PhylogeneticInfo() PhylogeneticInformation() CladisticInformation()
Cladistic information content of a tree
Consensus()
Construct consensus trees
J1Index() JQIndex()
Robust universal tree balance index
SisterSize() RootNodeDistance() RootNodeDist()
"Stemwardness" of a leaf
TotalCopheneticIndex() TCIContext()
Total Cophenetic Index
ConsensusWithout() MarkMissing()
Reduced consensus, omitting specified taxa
MatchEdges() MatchNodes()
Match nodes and edges between trees
NSplits() NPartitions()
Number of distinct splits
NTip()
Number of leaves in a phylogenetic tree
NodeNumbers()
Numeric index of each node in a tree NodeNumbers() returns a sequence corresponding to the nodes in a tree
PathLengths()
Calculate length of paths between each pair of vertices within tree
SplitsInBinaryTree()
Maximum splits in an n-leaf tree
TipLabels() AllTipLabels()
Extract tip labels
TreeIsRooted()
Is tree rooted?
RoguePlot()
Visualize position of rogue taxa
PairwiseDistances()
Distances between each pair of trees
TopologyOnly()
Remove metadata from trees

Phylogenetic data

Functions for modifying and evaluating datasets.

MatrixToPhyDat() PhyDatToMatrix()
Convert between matrices and phyDat objects
StringToPhyDat() StringToPhydat() PhyToString() PhyDatToString() PhydatToString()
Convert between strings and phyDat objects
ArtificialExtinction() ArtEx()
Artificial Extinction

Parsers

Functions to parse or write files.

as.Newick()
Write a phylogenetic tree in Newick format
ApeTime()
Read modification time from "ape" Nexus file
ExtractTaxa() NexusTokens()
Extract taxa from a matrix block
NewickTree()
Write Newick Tree
ReadCharacters() ReadTntCharacters() ReadNotes() ReadAsPhyDat() ReadTntAsPhyDat() PhyDat()
Read phylogenetic characters from file
StringToPhyDat() StringToPhydat() PhyToString() PhyDatToString() PhydatToString()
Convert between strings and phyDat objects
ReadTntTree() TntText2Tree() TNTText2Tree()
Parse TNT Tree
WriteTntCharacters()
Write morphological character matrix to TNT file
EndSentence()
Add full stop to end of a sentence
MorphoBankDecode()
Decode MorphoBank text
RightmostCharacter()
Rightmost character of string
Unquote()
Remove quotation marks from a string
ReadMrBayesTrees() ReadMrBayes() MrBayesTrees()
Read posterior tree sample produced by MrBayes

Split manipulation

Functions that manipulate bipartition splits.

DropTip() DropTipPhylo() KeepTipPreorder() KeepTipPostorder() KeepTip()
Drop leaves from tree
Subsplit()
Subset of a split on fewer leaves
TrivialSplits() WithoutTrivialSplits()
Identify and remove trivial splits
LabelSplits()
Label splits
NSplits() NPartitions()
Number of distinct splits
NTip()
Number of leaves in a phylogenetic tree
PolarizeSplits()
Polarize splits on a single taxon
SplitFrequency() SplitNumber() ForestSplits() TreeSplits()
Frequency of splits
as.Splits() as.logical(<Splits>)
Convert object to Splits
SplitsInBinaryTree()
Maximum splits in an n-leaf tree
TipLabels() AllTipLabels()
Extract tip labels
TipsInSplits() SplitImbalance()
Tips contained within splits
in.Splits() match() `%in%`(<Splits>,<Splits>)
Split matching
xor()
Exclusive OR operation

Information and combinatorics

Functions to calculate factorial quantities.

Split support

Calculate and depict support for splits (‘edges’ / ‘nodes’) in trees.

LabelSplits()
Label splits
SplitFrequency() SplitNumber() ForestSplits() TreeSplits()
Frequency of splits
SupportColour() SupportColor()
Colour for node support value

Datasets

Data that accompanies the package.

brewer
Brewer palettes
doubleFactorials
Double factorials
Lobo.data Lobo.phy
Data from Zhang et al. 2016
logDoubleFactorials
Natural logarithms of double factorials
nRootedShapes nUnrootedShapes
Number of rooted / unrooted tree shapes

Utility functions

Miscellaneous functions to simplify or expedite basic functionality.

as.multiPhylo()
Convert object to multiPhylo class
as.ClusterTable()
Convert phylogenetic tree to ClusterTable
as.matrix(<ClusterTable>) print(<ClusterTable>) summary(<ClusterTable>)
S3 methods for ClusterTable objects
Hamming()
Hamming distance between taxa in a phylogenetic dataset
MSTEdges() MSTLength()
Minimum spanning tree
RightmostCharacter()
Rightmost character of string
SampleOne()
Quickly sample
sapply64() vapply64() replicate64()
Apply a function that returns 64-bit integers over a list or vector
sort(<multiPhylo>) `==`(<phylo>) `<`(<phylo>) `>`(<phylo>) `==`(<MixedBase>) `<`(<MixedBase>) `>`(<MixedBase>)
Sort a list of phylogenetic trees
UnshiftTree()
Add tree to start of list

Developer functions

Efficient functions without input checks, for developers

edge_to_splits()
Efficiently convert edge matrix to splits