Commit ff73f17e authored by Philippe Veber's avatar Philippe Veber
Browse files

update wrt phylogenetics

parent a56faf3a
......@@ -68,22 +68,13 @@ let tag_tree t tagged_leaves =
Fitch.fitch ~n:2 ~category t
|> transfer_tag_to_branches
let with_inner_newick_tree tree ~f =
let open Phylogenetics in
match (tree : Newick.t) with
| Tree t -> Newick.Tree (f t)
| Branch (Branch { tip ; data }) ->
Newick.Branch (
Tree.branch data (f tip)
)
let%pworkflow clip_tree_on_alignment tree ali =
let open Phylogenetics in
let tree = Newick.from_file [%path tree] in
let ali = Phylip.read_exn ~strict:false [%path ali] in
let ali_species = List.map ali.items ~f:(fun it -> it.name) in
let clipped_tree =
with_inner_newick_tree tree ~f:(fun tree ->
Newick.map_inner_tree tree ~f:(fun tree ->
match
Tree.leafset_generated_subtree tree
(fun bi -> bi.Newick.name) ali_species
......@@ -105,7 +96,7 @@ let tree_of_convergent_species tree species =
let ensembl_tree = Newick.from_file omm_tree in
let tagged_tree =
with_inner_newick_tree ensembl_tree ~f:(fun t ->
Newick.map_inner_tree ensembl_tree ~f:(fun t ->
tag_tree t (String.Set.of_list species)
)
in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment