elynx-tree-0.7.0.1: Handle phylogenetic trees
Copyright2022 Dominik Schrempf
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

ELynx.Tree.Mrca

Description

Creation date: Wed Jun 29 15:57:09 2022.

Specify nodes using most recent common ancestors (MRCA).

Synopsis

Documentation

isAncestor :: Ord a => Set a -> Tree e a -> Bool Source #

Test if the root node of the given tree is an ancestor of the given leaves.

isMrca :: Ord a => Set a -> Tree e a -> Bool Source #

Test if the root node of the given tree is the MRCA of the given leaves.

getPathToMrca :: (Ord a, Show a) => Set a -> Tree e a -> Either String Path Source #

Get the path to the MRCA of the given leaves on the given tree.

Return Left if:

  • The tree has duplicate leaves.
  • The MRCA cannot be found.

getTreeAtMrca :: (Ord a, Show a) => Set a -> Tree e a -> Either String (Tree e a) Source #

findNode :: (Ord a, Show a) => a -> Tree e a -> Either String (Set a) Source #

Find a node on a tree.

If the node is found, the node is specified by the MRCA of the returned set of leaves. The set will contain one element if the node is a leaf, or two elements, if the node is internal.

Return Left if:

  • The tree has duplicate labels.
  • The node cannot be found.
  • The node is a degree two node.