Compute the transfer dissimilarity between phylogenetic trees, as defined by Takazawa2026;textualTreeDist. The transfer dissimilarity uses the transfer distance Lemoine2018TreeDist to compare bipartitions, providing a finer-grained measure than the Robinson--Foulds distance. Each split in each tree is scored by how many taxa must be moved to match its closest counterpart in the other tree, and these scores are summed.
TransferDist(
tree1,
tree2 = NULL,
scale = TRUE,
normalize = FALSE,
reportMatching = FALSE
)TransferDistance(
tree1,
tree2 = NULL,
scale = TRUE,
normalize = FALSE,
reportMatching = FALSE
)
TransferDistSplits(
splits1,
splits2,
nTip = attr(splits1, "nTip"),
scale = TRUE,
reportMatching = FALSE
)
TransferDist() returns an object of class dist (if tree2 is
NULL), a numeric matrix (if both tree1 and tree2 are lists), or a
numeric value (for a single pair). If reportMatching = TRUE, the
return value carries matching and pairScores attributes.
Trees of class phylo, with leaves labelled identically,
or lists of such trees to undergo pairwise comparison. Where implemented,
tree2 = NULL will compute distances between each pair of trees in the list
tree1 using a fast algorithm based on
Day1985;textualTreeDist.
Logical; if TRUE (default), use the scaled transfer
dissimilarity. If FALSE, use the unscaled transfer dissimilarity.
If a numeric value is provided, this will be used as a
maximum value against which to rescale results.
If TRUE, results will be rescaled against a maximum value calculated from
the specified tree sizes and topology, as specified in the "Normalization"
section below.
If FALSE, results will not be rescaled.
Logical specifying whether to return the clade matchings as an attribute of the score.
Logical matrices where each row corresponds to a leaf,
either listed in the same order or bearing identical names (in any sequence),
and each column corresponds to a split, such that each leaf is identified as
a member of the ingroup (TRUE) or outgroup (FALSE) of the respective
split.
(Optional) Integer specifying the number of leaves in each split.
When normalize = TRUE, the scaled transfer dissimilarity is divided by
2 * (n - 3), placing it in the range [0, 1]. The unscaled version is
divided by the maximum possible unscaled dissimilarity
(following Takazawa2026;textualTreeDist).
The scaled variant divides each split's contribution by its depth minus
one, giving equal weight to all splits regardless of their depth (analogous
to the Robinson--Foulds distance). The unscaled variant uses raw transfer
distances, giving more weight to deep splits. Neither variant satisfies
the triangle inequality for trees with six or more tips.
Other tree distances:
HierarchicalMutualInfo(),
JaccardRobinsonFoulds(),
KendallColijn(),
MASTSize(),
MatchingSplitDistance(),
NNIDist(),
NyeSimilarity(),
PathDist(),
Robinson-Foulds,
SPRDist(),
TreeDistance()
library(TreeTools)
TransferDist(BalancedTree(8), PectinateTree(8))
TransferDist(BalancedTree(8), PectinateTree(8), scale = FALSE)
# All-pairs
TransferDist(as.phylo(0:5, 8))
Run the code above in your browser using DataLab