elynx-tree-0.6.0.0: Handle phylogenetic trees
Copyright(c) Dominik Schrempf 2021
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

ELynx.Topology.Rooted

Description

Creation date: Sat Jul 11 10:28:28 2020.

A rooted Topology differs from a classical rooted rose Tree in that it does not have internal node labels. The leaves have labels.

For rooted trees with branch labels, see ELynx.Tree.Rooted.

Synopsis

Data type

data Topology a Source #

Rooted topologies with leaf labels.

Constructors

Node 

Fields

Leaf 

Fields

Instances

Instances details
Monad Topology Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

(>>=) :: Topology a -> (a -> Topology b) -> Topology b #

(>>) :: Topology a -> Topology b -> Topology b #

return :: a -> Topology a #

Functor Topology Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

fmap :: (a -> b) -> Topology a -> Topology b #

(<$) :: a -> Topology b -> Topology a #

Applicative Topology Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

pure :: a -> Topology a #

(<*>) :: Topology (a -> b) -> Topology a -> Topology b #

liftA2 :: (a -> b -> c) -> Topology a -> Topology b -> Topology c #

(*>) :: Topology a -> Topology b -> Topology b #

(<*) :: Topology a -> Topology b -> Topology a #

Foldable Topology Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

fold :: Monoid m => Topology m -> m #

foldMap :: Monoid m => (a -> m) -> Topology a -> m #

foldMap' :: Monoid m => (a -> m) -> Topology a -> m #

foldr :: (a -> b -> b) -> b -> Topology a -> b #

foldr' :: (a -> b -> b) -> b -> Topology a -> b #

foldl :: (b -> a -> b) -> b -> Topology a -> b #

foldl' :: (b -> a -> b) -> b -> Topology a -> b #

foldr1 :: (a -> a -> a) -> Topology a -> a #

foldl1 :: (a -> a -> a) -> Topology a -> a #

toList :: Topology a -> [a] #

null :: Topology a -> Bool #

length :: Topology a -> Int #

elem :: Eq a => a -> Topology a -> Bool #

maximum :: Ord a => Topology a -> a #

minimum :: Ord a => Topology a -> a #

sum :: Num a => Topology a -> a #

product :: Num a => Topology a -> a #

Traversable Topology Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

traverse :: Applicative f => (a -> f b) -> Topology a -> f (Topology b) #

sequenceA :: Applicative f => Topology (f a) -> f (Topology a) #

mapM :: Monad m => (a -> m b) -> Topology a -> m (Topology b) #

sequence :: Monad m => Topology (m a) -> m (Topology a) #

Eq a => Eq (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

(==) :: Topology a -> Topology a -> Bool #

(/=) :: Topology a -> Topology a -> Bool #

Data a => Data (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Topology a -> c (Topology a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Topology a) #

toConstr :: Topology a -> Constr #

dataTypeOf :: Topology a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Topology a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Topology a)) #

gmapT :: (forall b. Data b => b -> b) -> Topology a -> Topology a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Topology a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Topology a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Topology a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Topology a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Topology a -> m (Topology a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Topology a -> m (Topology a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Topology a -> m (Topology a) #

Read a => Read (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Show a => Show (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

showsPrec :: Int -> Topology a -> ShowS #

show :: Topology a -> String #

showList :: [Topology a] -> ShowS #

Generic (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Associated Types

type Rep (Topology a) :: Type -> Type #

Methods

from :: Topology a -> Rep (Topology a) x #

to :: Rep (Topology a) x -> Topology a #

NFData a => NFData (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

Methods

rnf :: Topology a -> () #

ToJSON a => ToJSON (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

FromJSON a => FromJSON (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

type Rep (Topology a) Source # 
Instance details

Defined in ELynx.Topology.Rooted

type Rep (Topology a) = D1 ('MetaData "Topology" "ELynx.Topology.Rooted" "elynx-tree-0.6.0.0-FQkEU9t6m33732ommPyIXg" 'False) (C1 ('MetaCons "Node" 'PrefixI 'True) (S1 ('MetaSel ('Just "forest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Forest a))) :+: C1 ('MetaCons "Leaf" 'PrefixI 'True) (S1 ('MetaSel ('Just "label") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

type Forest a = NonEmpty (Topology a) Source #

Shorthand.

fromRoseTree :: Tree a -> Topology a Source #

Convert a rooted rose tree to a rooted topology. Internal node labels are lost.

fromBranchLabelTree :: Tree e a -> Topology a Source #

Convert a rooted, branch-label tree to a rooted topology. Branch labels and internal node labels are lost.

toBranchLabelTreeWith :: e -> a -> Topology a -> Tree e a Source #

Convert a rooted topology to a rooted, branch-label tree. Use the given node label at internal nodes.

Access leaves, branches and labels

leaves :: Topology a -> [a] Source #

List of leaves.

duplicateLeaves :: Ord a => Topology a -> Bool Source #

Check if a topology has duplicate leaves.

setLeaves :: Traversable t => [b] -> t a -> Maybe (t b) Source #

Set leaf labels in pre-order.

Return Nothing if the provided list of leaf labels is too short.

identify :: Traversable t => t a -> t Int Source #

Label the leaves in pre-order with unique indices starting at 0.

Structure

degree :: Topology a -> Int Source #

The degree of the root node.

depth :: Topology a -> Int Source #

Depth of a topology.

See depth.

prune :: Topology a -> Topology a Source #

Prune degree two nodes.

See prune.

dropLeavesWith :: (a -> Bool) -> Topology a -> Maybe (Topology a) Source #

Drop leaves satisfying predicate.

See dropNodesWith.

zipTopologiesWith :: (a1 -> a2 -> a) -> Topology a1 -> Topology a2 -> Maybe (Topology a) Source #

Zip leaves of two equal topologies.

See zipTreesWith.