Copyright | (c) Dominik Schrempf 2019 |
---|---|
License | GPL-3 |
Maintainer | dominik.schrempf@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Creation date: Thu Jun 13 17:15:54 2019.
Various distance functions for phylogenetic trees (and binary trees in general). All trees are assumed to be UNROOTED.
Synopsis
- symmetric :: (Ord a, Named a) => Tree a -> Tree a -> Int
- symmetricWith :: Ord b => (a -> b) -> Tree a -> Tree a -> Int
- incompatibleSplits :: (Ord a, Named a) => Tree a -> Tree a -> Int
- incompatibleSplitsWith :: (Ord b, Show b) => (a -> b) -> Tree a -> Tree a -> Int
- branchScore :: (Ord a, Named a, Measurable a) => Tree a -> Tree a -> Double
- branchScoreWith :: (Ord a, Ord b, Floating c) => (a -> b) -> (a -> c) -> Tree a -> Tree a -> c
- pairwise :: (a -> a -> b) -> [a] -> [(Int, Int, b)]
- adjacent :: (Tree a -> Tree a -> b) -> [Tree a] -> [b]
Documentation
symmetric :: (Ord a, Named a) => Tree a -> Tree a -> Int Source #
See symmetricWith
, but with id
for comparisons.
symmetricWith :: Ord b => (a -> b) -> Tree a -> Tree a -> Int Source #
Symmetric (Robinson-Foulds) distance between two trees. Before comparing
the leaf labels, apply a given function. This is useful, for example, to
compare the labels of Named
trees on their names
only. The tree is assumed to be UNROOTED!
XXX: Comparing a list of trees with this function recomputes bipartitions.
incompatibleSplits :: (Ord a, Named a) => Tree a -> Tree a -> Int Source #
See incompatibleSplitsWith
, use id
for comparisons.
incompatibleSplitsWith :: (Ord b, Show b) => (a -> b) -> Tree a -> Tree a -> Int Source #
Number of incompatible splits. Similar to symmetricWith
but all
bipartition induced by multifurcations are considered. For a detailed
description of how the distance is calculated, see compatible
.
A multifurcation on a tree may (but not necessarily does) represent missing information about the order of bifurcations. In this case, it is interesting to get a set of compatible bifurcations of the tree. For example, the tree
(A,(B,C,D))
induces the following bipartitions:
A|BCD B|ACD
C|ABD D|ABC
Those are also reported by the function bipartitions
. However, the tree is
additionally compatible with the following hidden bipartitions:
AB|CD AC|BD AD|BC
For an explanation of how compatibility of a bipartition with a
multipartition is checked, see compatible
. Before using compatible
,
bipartitions are simply converted to multipartitions with two subsets.
Only if a bipartition is not compatible with all induced multifurcations of the other tree, it is incompatible.
XXX: Comparing a list of trees with this function recomputes bipartitions.
branchScore :: (Ord a, Named a, Measurable a) => Tree a -> Tree a -> Double Source #
See branchScoreWith
, use id
for comparisons.
:: (Ord a, Ord b, Floating c) | |
=> (a -> b) | Label to compare on |
-> (a -> c) | Branch information (e.g., length) associated with a node |
-> Tree a | |
-> Tree a | |
-> c |
Compute branch score distance between two trees. Before comparing the leaf
labels, apply a function. This is useful, for example, to compare the labels
of Named
trees on their names only. The branch
information which is compared to compute the distance is extracted from the
nodes with a given function. Assumes that the trees are UNROOTED.
XXX: Comparing a list of trees with this function recomputes bipartitions.