elynx-tree-0.0.1: Handle phylogenetic trees

Copyright(c) Dominik Schrempf 2019
LicenseGPL-3
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

ELynx.Data.Tree.Bipartition

Contents

Description

Creation date: Fri Aug 30 15:28:17 2019.

Bipartitions are weird in that > Bipartition x y == Bipartition y x is True.

Also, > Bipartition x y > Bipartition y x is False, even when x > y.

That's why we have to make sure that for > Bipartition x y we always have x >= y.

Synopsis

The Bipartition data type.

data Bipartition a Source #

Bipartitions with Sets, since order of elements within the leaf sets is not important. Also the order of the two leaf sets of the bipartition is not important (see Eq instance definition).

bp :: Ord a => Set a -> Set a -> Bipartition a Source #

Create a bipartition from two Sets.

bpmap :: (Ord a, Ord b) => (a -> b) -> Bipartition a -> Bipartition b Source #

Map a function over all elements in the Bipartitions.

Working with Bipartitions.

bipartitions :: Ord a => Tree a -> Set (Bipartition a) Source #

Get all bipartitions.

bipartitionToBranch Source #

Arguments

:: (Ord a, Ord b, Monoid c) 
=> (a -> b)

Value to compare on

-> (a -> c)

Convert node to branch length

-> Tree a

Tree to dissect

-> Map (Bipartition b) c 

Each branch on a Tree defines a unique Bipartition of leaves. Convert a tree into a Map from each Bipartition to the branch inducing the respective Bipartition. The information about the branch is extracted from the nodes with a given function. If the tree has degree two nodes, the branch values are combined; a unity element is required, and so we need the Monoid type class constraint. Checks if leaves are unique.

bipartitionsCombined :: (Ord a, Show a) => Tree a -> Set (Bipartition a) Source #

Get all bipartitions, but combine leaves from multifurcations. This is useful to find incompatible splits. See incompatibleSplitsDistance. Assume that a root node with three children is actually not a multifurcation (because then we would have no induced bypartitions), but rather corresponds to an unrooted tree.