package phylogenetics
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=de867d7cc017a8e434dab43ef16f0f6495973892cd7b6a8446b18e79393704a8
sha512=0209538caf94be47eabcaa25399c54849bd4fa0fc79e0579acee27f46ef3b72aa50e17bdb48fed8e86674d4caee6c1c4c423833a2757db12e2a6cc28234510de
doc/phylogenetics/Phylogenetics/Tree/index.html
Module Phylogenetics.TreeSource
Tree structure with annotations on leaves, internal nodes and branches.
Node { data; branches } represents a node in the tree with node data of type 'n and a non-empty list of branches
Leaf l represents a leaf in the tree with leaf data of type 'l.
val sexp_of_t :
('n -> Sexplib0.Sexp.t) ->
('l -> Sexplib0.Sexp.t) ->
('b -> Sexplib0.Sexp.t) ->
('n, 'l, 'b) t ->
Sexplib0.Sexp.tval sexp_of_branch :
('n -> Sexplib0.Sexp.t) ->
('l -> Sexplib0.Sexp.t) ->
('b -> Sexplib0.Sexp.t) ->
('n, 'l, 'b) branch ->
Sexplib0.Sexp.tval t_of_sexp :
(Sexplib0.Sexp.t -> 'n) ->
(Sexplib0.Sexp.t -> 'l) ->
(Sexplib0.Sexp.t -> 'b) ->
Sexplib0.Sexp.t ->
('n, 'l, 'b) tval branch_of_sexp :
(Sexplib0.Sexp.t -> 'n) ->
(Sexplib0.Sexp.t -> 'l) ->
(Sexplib0.Sexp.t -> 'b) ->
Sexplib0.Sexp.t ->
('n, 'l, 'b) branchnode a branches constructs a node with data a and the given list of branches.
binary_node a b1 b2 constructs a binary node with data a and the two branches b1 and b2.
branch c tip constructs a branch with data c and the given sub-tree tip.
data t returns the data contained in the leaf or root node of the tree t.
val to_printbox :
?node:('n -> string) ->
?leaf:('l -> string) ->
?branch:('b -> string option) ->
('n, 'l, 'b) t ->
PrintBox.tto_printbox ?node ?leaf ?branch t converts the tree t to a printable representation using the provided functions for converting node, leaf, and branch data to strings.
val map :
('a, 'b, 'c) t ->
node:('a -> 'd) ->
leaf:('b -> 'e) ->
branch:('c -> 'f) ->
('d, 'e, 'f) tmap t ~node ~leaf ~branch maps the node, leaf, and branch data of the tree t using the provided functions node, leaf, and branch, respectively.
val map2_exn :
('a, 'b, 'c) t ->
('d, 'e, 'f) t ->
node:('a -> 'd -> 'x) ->
leaf:('b -> 'e -> 'y) ->
branch:('c -> 'f -> 'z) ->
('x, 'y, 'z) tmap2_exn t1 t2 ~node ~leaf ~branch maps the corresponding node, leaf, and branch data of the trees t1 and t2 using functions node, leaf, and branch, respectively. Raises an exception if the two trees have different structures.
val map_branch2_exn :
('a, 'b, 'c) branch ->
('d, 'e, 'f) branch ->
node:('a -> 'd -> 'x) ->
leaf:('b -> 'e -> 'y) ->
branch:('c -> 'f -> 'z) ->
('x, 'y, 'z) branchmap_branch2_exn b1 b2 ~node ~leaf ~branch maps the corresponding node, leaf, and branch data of the branches b1 and b2 using functions node, leaf, and branch, respectively. Raises an exception if the two branches have different structures.
val propagate :
('n1, 'l1, 'b1) t ->
init:'s ->
node:('s -> 'n1 -> 's * 'n2) ->
leaf:('s -> 'l1 -> 'l2) ->
branch:('s -> 'b1 -> 's * 'b2) ->
('n2, 'l2, 'b2) tpropagate t ~init ~node ~leaf ~branch propagates the values of node, leaf, and branch data in the tree t using the provided update functions node, leaf, and branch. The initial state init is threaded through the propagation.
val prefix_traversal :
('n, 'l, 'b) t ->
init:'c ->
node:('c -> 'n -> 'c) ->
leaf:('c -> 'l -> 'c) ->
branch:('c -> 'b -> 'c) ->
'cprefix_traversal t ~init ~node ~leaf ~branch performs a prefix traversal of the tree t using the provided update functions node, leaf, and branch. The initial state init is threaded through the traversal. Returns the final state after the traversal.
fold_leaves t ~init ~f folds over the leaf data in the tree t using the provided folding function f and initial accumulator init. Returns the final accumulator after folding.
val unfold :
('n, 'l, 'b) t ->
init:'a ->
branch:('e -> 'b -> 'a * 'bb) ->
leaf:('a -> 'l -> 'e * 'll) ->
node:('a -> 'n -> 'e * 'nn) ->
('nn, 'll, 'bb) tunfold t ~init ~branch ~leaf ~node unfolds the tree t into a new tree using the provided functions branch, leaf, and node. The initial state init is threaded through the unfolding.