TransferDist: Transfer dissimilarity between phylogenetic trees

View source: R/tree_distance_transfer.R

TransferDistR Documentation

Transfer dissimilarity between phylogenetic trees

Description

Compute the transfer dissimilarity between phylogenetic trees, as defined by \insertCiteTakazawa2026;textualTreeDist. The transfer dissimilarity uses the transfer distance \insertCiteLemoine2018TreeDist 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.

Usage

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
)

Arguments

tree1, tree2

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 \insertCiteDay1985;textualTreeDist.

scale

Logical; if TRUE (default), use the scaled transfer dissimilarity. If FALSE, use the unscaled transfer dissimilarity.

normalize

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.

reportMatching

Logical specifying whether to return the clade matchings as an attribute of the score.

splits1, splits2

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.

nTip

(Optional) Integer specifying the number of leaves in each split.

Details

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.

Value

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.

Normalization

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 \insertCiteTakazawa2026;textualTreeDist).

References

\insertAllCited

See Also

Other tree distances: HierarchicalMutualInfo(), JaccardRobinsonFoulds(), KendallColijn(), MASTSize(), MatchingSplitDistance(), NNIDist(), NyeSimilarity(), PathDist(), Robinson-Foulds, SPRDist(), TreeDistance()

Examples

library(TreeTools)
TransferDist(BalancedTree(8), PectinateTree(8))
TransferDist(BalancedTree(8), PectinateTree(8), scale = FALSE)

# All-pairs
TransferDist(as.phylo(0:5, 8))


TreeDist documentation built on June 10, 2026, 5:06 p.m.