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 DropTip.phylo DropTip.Splits DropTipPhylo DropTip.multiPhylo DropTip.list DropTip.NULL 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 RenumberTips.phylo RenumberTips.multiPhylo RenumberTips.list RenumberTips.NULL

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() AllDescendantEdges()

Identify descendant edges

EdgeAncestry()

Ancestors of an edge

EdgeDistances()

Distance between edges

ListAncestors() AllAncestors()

List ancestors

MRCA()

Most recent common ancestor

NDescendants()

Count descendants for each node in a tree

NodeDepth()

Distance of each node from tree exterior

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() 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

SisterSize() RootNodeDistance() RootNodeDist()

"Stemwardness" of a leaf

TotalCopheneticIndex() TCIContext()

Total Cophenetic Index

ConsensusWithout() MarkMissing()

Reduced consensus, omitting specified taxa

NSplits NPartitions NSplits.phylo NSplits.list NSplits.multiPhylo NSplits.Splits NSplits.numeric NSplits.NULL NSplits.ClusterTable NSplits.character

Number of distinct splits

NTip()

Number of leaves in a phylogenetic tree

PathLengths()

Calculate length of paths between each pair of vertices within tree

SplitsInBinaryTree SplitsInBinaryTree.list SplitsInBinaryTree.multiPhylo SplitsInBinaryTree.numeric SplitsInBinaryTree.NULL SplitsInBinaryTree.default SplitsInBinaryTree.Splits SplitsInBinaryTree.phylo

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

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 DropTip.phylo DropTip.Splits DropTipPhylo DropTip.multiPhylo DropTip.list DropTip.NULL 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 NSplits.phylo NSplits.list NSplits.multiPhylo NSplits.Splits NSplits.numeric NSplits.NULL NSplits.ClusterTable NSplits.character

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 SplitsInBinaryTree.list SplitsInBinaryTree.multiPhylo SplitsInBinaryTree.numeric SplitsInBinaryTree.NULL SplitsInBinaryTree.default SplitsInBinaryTree.Splits SplitsInBinaryTree.phylo

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.

N1Spr() IC1Spr()

Number of trees one SPR step away

DoubleFactorial() DoubleFactorial64() LnDoubleFactorial() Log2DoubleFactorial() LogDoubleFactorial() LnDoubleFactorial.int() LogDoubleFactorial.int()

Double factorial

NPartitionPairs()

Distributions of tips consistent with a partition pair

CladisticInfo() PhylogeneticInfo() PhylogeneticInformation() CladisticInformation()

Cladistic information content of a tree

NRooted() NUnrooted() NRooted64() NUnrooted64() LnUnrooted() LnUnrooted.int() Log2Unrooted() Log2Unrooted.int() LnRooted() LnRooted.int() Log2Rooted() Log2Rooted.int() LnUnrootedSplits() Log2UnrootedSplits() NUnrootedSplits() LnUnrootedMult() Log2UnrootedMult() NUnrootedMult()

Number of trees

TreesMatchingTree() LnTreesMatchingTree() Log2TreesMatchingTree()

Number of trees containing a tree

CharacterInformation()

Character information content

SplitInformation() MultiSplitInformation()

Phylogenetic information content of splitting leaves into two partitions

SplitMatchProbability() LnSplitMatchProbability()

Probability of matching this well

TreesMatchingSplit() LnTreesMatchingSplit() Log2TreesMatchingSplit()

Number of trees matching a bipartition split

UnrootedTreesMatchingSplit() LnUnrootedTreesMatchingSplit() Log2UnrootedTreesMatchingSplit()

Number of trees consistent with split

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