Consensus(trees, p)now retains a split present in exactly a proportionpof trees (i.e. inceiling(p * length(trees))trees) forp > 0.5, matching the documentation andape::consensus(); previously such a split was dropped at exact thresholds (e.g. a split in 2 of 3 trees withp = 2/3). The majority thresholdp = 0.5is unchanged (a split must occur in more than half the trees).
- Guarantee preorder return from
root_on_node()to simplifyConsensus()internal pre-processing Consensus()andSplitFrequency()defer materialising a split's bit pattern until it is needed, so splits that never reach the consensus threshold are no longer built. Identical results; up to ~13× faster for large trees (greatest gains for tall trees / many tips), with no change at small sizes.RenumberTips()relabels an unlabelledmultiPhyloorlistof trees in a single C++ pass instead of a per-tree R loop, with a no-op fast path for trees already in the target order. Speeds upConsensus()and other callers when combining many trees; results are unchanged.Consensus()no longer copies every input tree to strip branch lengths and node labels (the consensus core ignores both); it now coerces in place, trimming wrapper overhead (~25% faster on small forests of many short trees). Results are unchanged.
fastmatchmoved from Imports to Suggests.
RandomTree(),YuleTree(),PectinateTree(),BalancedTree(),StarTree(), andSingleTaxonTree()allowlengthsto accept a function that generates edge lengths (e.g.RandomTree(8, lengths = runif)).PaintTree()assigns colours to every edge, leaf, and internal node such that sister clades occupy adjacent hue bands proportional to their tip counts, with saturation growing from zero at the root to one at every tip.NexusTokensToInteger()converts character data to integers, mapping uncertain tokens toNA.ReadTntCharacters()attaches anxgroupattribute (factor) when a TNTxgrouppartition block is present.
Consensus()computes majority-rule and threshold consensus trees in time linear in the number of trees (previously quadratic), after Jansson, Shen & Sung (2016); implementation informed by theirFACTpackage.SplitFrequency()inherits the same single-pass speed-up.
NexusTokens()once again handles polymorphism tokens with internal whitespace (e.g.(1 2),{0 1}).
ReadTntCharacters()now handles multi-line comments, bare&continuations,@taxonomysuffixes, name-only taxon lines, mid-linexread, smart-quote names (Windows-1252), and packed multi-taxon lines.
- Drop
stringidependency. as.character.Splits()re-implemented in C++; ~3× faster on 200-tip trees.
Consensus()andSplitFrequency()now respond to user interrupts during long-running computations.SL_MAX_TIPScompile-time constant increased to 32704, allowing support for larger trees.
EdgeRatio()reports the ratio of external:internal edges.SplitInformation()supportsSplitsandphyloobjects.sortandordersupportSplitsobjects.SplitFrequency(reference = NULL)returns frequency of all splits.as.TreeNumber()now supports trees with up to 51 leaves (previously 19). Trees with 20–51 leaves have more than 2^64 distinct topologies, so theirTreeNumberis stored as a decimal character string rather thaninteger64. The 19-leaf limit forinteger64-backed storage (andas.MixedBase()round-trips) is unchanged.as.TreeNumber()no longer warns for trees with 20–44 leaves.inst/include/TreeTools/tree_number.hadded to support downstream packages (e.g. TBRDist) viaLinkingTo: TreeTools. Provides 256-bit tree number encoding/decoding supporting up to 51 leaves, extended from the 44-leaf limit of the previousuint64_t-based implementation.
SplitFrequency(reference = NULL): split normalization moved to C++; internal split de-duplication uses hash map instead of ordered map.NodeDepth()for unrooted trees rewritten as O(n) two-pass C++ algorithm, replacing iterative R while-loop.duplicated.Splits()uses hash-based O(n) de-duplication, replacing O(n²) pairwise comparison.RenumberTips.multiPhylo()applies tip permutation in a single C++ call, avoiding per-tree overhead.
PhyDatToMatrix()no longer crashes on zero-characterphyDatobjects (e.g. from a star tree); returns a 0-column matrix with correct row names.AddUnconstrained()handles zero-characterphyDatinput gracefully.
RCurlmoved from Imports to Suggests;ReadMrBayesTrees()usesRCurl::url.exists()when available, falling back to base Rurl()for URL checks.
- Add method
RenumberTips.Splits(). FirstMatchingSplit(x)provides performant alternative tomatch(x)[[1]].- Support logical
poleinPolarizeSplits(). RenumberTree()supports numerictipOrderinput.- Support larger trees in
ClusterTableobjects.- Retires
CT_PUSHandCT_POPmacros.
- Retires
- Support larger trees in
Consensus().- Uses 32-bit integers, necessitating downstream changes to TreeDist.
- Remove hard limit on tree size in
SplitList. MatrixToPhyDat()gainstipLabelsparameter.- Document return value for
J1Index().
Cherries()counts the cherries in a binary tree.- New method
as.Splits.integer(). - Add methods for
NULLobjects.
- Fix
RoguePlot(sort = TRUE)(Rogue#33). - Remove R.cache dependency:
UnrootedKeys()now uses a native cache implementation.
- Require R 3.6.
- Remove deprecated functions
AllDescendantEdges(),.EnforceOutgroup(),ForestSplits(),in.Splits(),PhylogeneticInfo(),SpectrumLegend(),SplitNumber(),TreeSplits(). - Remove deprecated C++ macro
TREETOOLS_SPLITLIST_INIT.
- Compiler-safe vector initialization, resolving M1-SAN warnings.
SplitConsistent()calculates split (dis)agreement.LongBranch()identifies long-branched taxa.Treeness()computes the treeness (=stemminess) of a tree, a proxy for its phylogenetic signal.- Add
KeepTip()methods to correspond toDropTip(). Preorder()gainstopologyOnlyargument.
MakeTreeBinary()explicitly removes edge lengths.- Optimize
ClusterTableclass. - Optimize
NSplits(). - Remove exported C++ cache objects to prefer calculation with intrinsics.
- Other performance improvements.
- Fix
as.ClusterTable()when leaf order varies. - Fix regressions in
as.ClusterTable()that caused downstream errors. - Fix regressions in
PhyToString(). - Fix handling of multiple ambiguities in
Reweight().
Reweight()sets the weight of characters in a phylogenetic dataset.MatchStrings()checks for mismatched tip labels, suggesting corrections.RootTree()gainsfallbackargument to handle outgroups that do not root a tree.- Fix
MakeTreeBinary()labelling trees as in preorder. - Fix
as.Splits.matrix(tipLabels != NULL). - Improve performance of
PhyToString(). - Modernize aspects of C++ code.
-
AddTip(lengthBelow = NA)adds leaf at node without adding a new edge. -
BalancedTree()and equivalent gain alengthsparameter to specify edge lengths. -
Fix taxa misplaced by
RoguePlot(sort = TRUE). -
Fix unexpected polytomies in
Consensus()(#168).
- Support non-unique labels in
DropTip()checks.
-
%in%andmatchmethods for phylo / multiPhylo objects. -
Decompose()decomposes additive (ordered) phylogenetic characters by binary decomposition. -
Check for overflow in splits functions.
TopologyOnly()removes metadata from phylo objects.J1Index()computes the robust, universal tree balance measure of Lemant et al. 2022 doi:10.1093/sysbio/syac027, incorporating code by Rob Noble.
- Consistent sequence of list entries in phylo objects.
RandomTree()returns trees for < 3 leaves.root_on_node()handles trees with < 2 leaves.- Support larger trees in
TotalCopheneticIndex(), fixing #158.
- Set random seed and increase tolerance to avoid false negatives on tests.
YuleTree()generates a random tree by the Yule process.DescendantTips()complementsDescendantEdges(), rewritten in C++, fixing a bug when edges were not in preorder.NodeNumbers()returns the indices of nodes within a tree.
RandomTree(root = TRUE)roots the tree on a random edge.RoguePlot()$legendLabelsreturns suggested labels for legend.- Support node labels in
AddTip(),CollapseNode(),DropTip(),MakeTreeBinary(),Renumber(),Reorder(),SortTree(),Subtree()(#149). AddTip(edgeLength = NULL)defaults tolengthBelow. This will become the default in a future release.- An entry point to the C++ function
root_on_node()is now exported (intended for expert use only). - Fix handling of weighted trees by
root_on_node(). - Use
KeepTip()internally soSplitFrequency()supportsSplitsobjects as documented.
TipTimedTree()displays trees where leaves are associated with absolute ages.ReadMrBayesTrees()samples trees from posterior of MrBayes output.is.TreeNumber()method.
- Support zero-edge trees in
as.Splits()andNSplits(). - Support empty constraints in
AddUnconstrained(). - Add space between tokens in
WriteTntCharacters()to support continuous characters (#139).
- Change order of parameters in
DescendantEdges() - Deprecate
AllDescendantEdges(); useDescendantEdges()instead. - Deprecate
EnforceOutgroup(); useRootTree()instead. - Remove
NonDuplicateRoot()andin.Splits().
- Improve support for comments in
ReadNotes(). - Support Nexus-escaped
''s inReadCharacters(). - Add
legendparameter toRoguePlot(). RoguePlot()now returns invisibly.- Deprecate
SpectrumLegend()-- spun off to separate "PlotTools" package.
-
AddUnconstrained()andImposeConstraint()handle wider range of inputs. -
PhyDatToMatrix()can (and by default does) override levels to write ambiguous tokens in custom formats such as{01}. -
Call C functions using symbols, not strings.
-
ZeroTaxonTree()creates aphyloobject with no leaves. -
DropTip()gains new methodsDropTip.list()andDropTip.NULL(). -
as.matrix.phylo()converts a tree to a matrix representation, allowing a tree to be passed as a constraint toImposeConstraint(). -
as.matrix.Splits()andas.matrix.phyDat()methods added as synonyms toas.logical.Splits()andPhyDatToMatrix().
-
Handle
TipLabels(0)andBalancedTree(0). -
Support zero-leaf trees in
as.Splits()andduplicated.Splits(). -
Support non-identical tip labels in
as.Splits(). -
Try Latin-1 encoding if
ReadCharacters()family fail under UTF-8.
-
TntOrder()renumbers a tree's nodes to match TNT's convention. -
head()andtail()methods for Splits objects. -
Set names of splits object with
names(splits) <- .... -
as.Splits()support character vectors in the form "...***".
-
ReadTntTree()reads tree tags and follows TNT node numbering conventions. -
SpectrumLegend()gainstitleparameter and more styling options. -
Support > 32767 trees in
Consensus()(#127). -
DropTip()speed improved when branch lengths are present.
-
ReadTntTree()supports multi-line trees. -
as.MixedBase()supports larger trees (44-32767 tips). -
Add deprecation warning to
in.Splits().
-
RenumberTips()drops "preorder" attribute, as reordering tip labels may break edge ordering guarantee. -
Native implementation of
ClusterTableclass. -
Replace
throwwithstopin C++ scripts.
AddTip(): Fix bug when adding tip to root of weighted tree.
-
rev.Splits()reverses order in which splits are listed. -
KeepTip.Splits()is a faster alternative toSubSplit(). -
%in%.Splits()retains names when comparing small splits (#40). -
sort.multiPhylo()sorts lists of trees according to their mixed base representation (#84). -
Bitwise manipulation of splits with
|,&,xor. -
as.MixedBase()uniquely represents binary trees as a mixed-base vector. -
PathLengths()describes all paths within a tree. -
KeptVerts()andKeptPaths()identify elements in reduced trees. -
PostorderOrder()describes a sequence of edges corresponding to a postorder traversal of a tree. -
SpectrumLegend()adds gradients to plot legends.
-
Improve handling of zero-split trees.
-
DropTip()no longer adds a root to unrooted trees, and retains edge lengths. -
Improve speed of
DropTip(), by an order of magnitude in some cases. -
Support edge lengths in
Preorder(),RootTree(),UnrootTree()andPostorder()(#49, #89). -
Fix bug when tree is rooted on a discontinuous outgroup.
-
SortTree()handles weighted and non-binary trees (#25, #25), and gains option to sort by tip labels. -
TipsInSplits(smallest = TRUE)counts tips in smaller bipartition. -
Fix a bug with
phyDatobjects inArtificialExtinction(). -
RenumberTips()allowstipOrderto contain elements not present intree. -
Use lighter Rcpp headers.
-
Small improvements to computational efficiency.
- Remove deprecated function
PostorderEdges()(#35).
RoguePlot()plots the positions of rogue taxa.
-
DropTip()gainscheckparameter to allow slightly faster operation where input is guaranteed to be valid. -
RandomTree()gainsnodesparameter allow the inclusion of polytomies. -
Infer
tipsparameter if missing inStringToPhyDat(). -
Remove dependency on "phangorn" (allowing use on R < 4.1)
-
Improve parsing of information from nexus files.
-
Export
DropTipPhylo()as wrapper toDropTip.phylo().
-
PhyDatToMatrix()optionally encodes ambiguous / inapplicable tokens asNA. -
Implement
sort.multiPhylo(). -
Update test suite for compatibility with "testthat" > 3.0.4 (@hadley, #83).
-
ConstrainedNJ()returns an approximation to a neighbour-joining tree that respects constraints. -
PolarizeSplits()marks a specified taxon as representing the ingroup of all splits. -
Add
KeepTip()and improve performance ofDropTip(). -
ImposeConstraint()makes a tree consistent with topological constraints. -
as.phylo.Splits()represents aSplitsobject as a tree. -
Consensus()is a faster C++ implementation ofape::consensus(). -
ClusterTable()C++ functionality imported from "TreeDist".
-
Warn when empty cells passed to
MatrixToPhyDat(). -
Warn when
LabelSplits(labels)lack names. -
SplitFrequency()drops tips fromforestthat aren't inreference. -
AddTipEverywhere()supports trees with < 3 leaves. -
Make
RootTree()andPhyDatToMatrix()more robust. -
Support
encodingoption inReadCharacters()function family. -
Support
CHARSTATELABELSinReadCharacters(). -
Support for more formatting quirks in
ReadNotes(). -
Better support ambiguous tokens in
WriteTntCharacters().
-
Fast matching functions from "fastmatch".
-
Improve efficiency of
Preorder()andPostorder(), and lift limit on tree size.
- Correct calculation of minimum value in
TCIContext(). - Extract tip labels from objects in
StringToPhyDat(). - Support
AddTip(tree, where = "tip name"). SplitFrequency()supports four-leaf trees.- Add
RootTree.matrix()method for edge matrices. - Add
TipLabels.phyDat()method. - Add
NULLmethods for tree reordering functions. - Additions and improvements to text parsing functions.
- Add
NTip.phyDat()method. - Update
MakeTreeBinary()docs and tests to reflect updated behaviour ofape::multi2di()in 'ape' v5.5.
AddTip()supports edge lengths.CladisticInfo()supportsSplitsobjects.as.multiPhylo()converts trees, datasets and Splits objects intomultiPhyloobjects.LabelSplits(labels = NULL)labels each split with its associated node.PhyDatToMatrix()supports integer-only levels.SortTree()supports lists of trees.- Improvements to
ReadTntCharacters()character block extraction (#50).
- Support star trees in
RootTree(). - Improve memory handling in
root_on_node(). - Documentation linkage.
MSTEdges()supports distance matrices with > 256 entries.- Package 'vdiffr' used conditionally.
MSTLength()reports length of minimum spanning tree.AllTipLabels()returns all labels from all trees in a list.PairwiseDistances()(from 'TreeDistData') computes distances between all pairs of trees in a list.ArtificialExtinction()gainsreplaceAlloption.WriteTntCharacters(types = ...)writes different character types to TNT file.- Tree characterization S3 methods: add
.defaultand.NULL.
MSTEdges()implemented in C++, improving runtime by orders of magnitude.- Improved parsing of TNT character files.
- Improved parsing of TNT files.
- Fix misspecified C++ linkage.
SisterSize()andRootNodeDist()measure sister-clade size and root-node distance.MSTEdges(): Edges of minimum spanning tree.SplitImbalance(): how balanced is each split?- New C++ functions
root_on_node()androot_binary()to root trees quickly and robustly.
-
TNTReadTree()handles additional punctuation characters. -
Import RdMacros package 'Rdpack'.
-
C++ implementation of
TipsInSplits(). -
Export C++ functions
preorder_edges_and_nodes()andpostorder_edges(). -
Remove obsolete copy of C++ code from 'phangorn'.
ArtificialExtinction(): Remove characters that are absent in a fossil template.WriteTntCharacters(): Write morphological dataset in TNT format.- Improve TNT dataset parsing.
- Documentation improvements.
RandomTree(): Draw tree from uniform distribution, instead of viaape::rtree().MakeTreeBinary(): Uniform equivalent ofape::multi2di().match.list()method for lists of splits.SplitsInBinaryTree(): How many splits occur in an n-leaf binary tree?vapply64(),sapply64(),replicate64(): helper functions when a function returns a 64-bit integer.
- Use methods for
UnrootTree(),RootTree(),RootOnNode()to support lists of trees.
CladisticInfo(): Calculate the information content of a tree.RootNode(): Which node is a tree's root?UnrootTree(): Safely remove a root node.NodeDepth(): Discriminate shallow from deep nodes.NodeOrder(),NDescendants(): Count edges incident to each node.CladeSizes(): Count leaves / nodes descended from each node.ListAncestors(): List ancestors of a node.LabelSplits(): Label splits on plotted tree.DropTip(): Remove tip, handling weird node orders.LeafLabelInterchange(): Exchange position of n tips.StarTree(): Generate unresolved tree.TotalCopheneticIndex()integrated from 'tci' package.
PostorderEdges(): usePostorder()instead.NonDuplicateRoot(): unused internal function.match.Splits(): usematch()instead.in.Splits(): use%in%.Splits()instead.
- Improve support for unrooted trees in
as.Splits(). - Use methods so
Reorderfunctions can handlemultiPhyloobjects and edges. - Handle funny node orders.
- Support continuous characters in
ReadCharacters(). - Improve performance of
as.logical.Splits()and related functions. - Fail nicely when trees are too large for memory.
- Fix memory leak in
as.Splits(). - Various under-the-hood improvements to functions.
- Documentation improvements.
- Catch hang-inducing bugs in
RootOnNode(). - Update
doubleFactorialscache to fixas.integer()rounding error. - Support unrooted trees in
AddTipEverywhere(). - Documentation improvements.
RootOnNode(): Quickly root a tree on a specified node.- Improve portability of C++ code.
as.Newick: Fast conversion to Newick format.as.TreeNumber: Tree shape enumeration.
- Add functions to translate trees to mixed base integers.
RenumberTipscan extract tip order fromphyloandSplitsobjects.- Documentation changes to satisfy CRAN submission requirements.
- Pre-release version spun out of 'TreeSearch' package. Some functionality is subject to change.