Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

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

orthomam: pdf repr of convergence in tree

parent 812f0b25
(library
(name reviewphiltrans)
(libraries core biotk biotope bistro.utils ocaml-r.graphics ocaml-r.grDevices phylogenetics.convergence reviewphiltrans_toolbox)
(libraries core biotk biotope bistro.utils gsl ocaml-r.graphics ocaml-r.grDevices phylogenetics.convergence reviewphiltrans_toolbox)
(preprocess
(pps ppx_jane ppx_csv_conv bistro.ppx ppx_here)))
......
......@@ -424,8 +424,65 @@ include Q
include Detection_pipeline.Make(Q)
let species_with_echolocation = [
"Rhinolophus ferrumequinum" ;
"Tursiops_truncatus" ;
"Orcinus_orca" ;
"Myotis_lucifugus" ;
"Eptesicus_fuscus" ;
"Tursiops_truncatus" ;
"Miniopterus_natalensis" ;
(* "Pteropus_vampyrus" ; unsure, i'd say no *)
(* "Pteropus alecto" ; unsure, i'd say no *)
"Lipotes_vexillifer" ;
"Hipposideros_armiger" ;
"Physeter_catodon" ;
"Rousettus_aegyptiacus" ; (* unsure, i'd say yes *)
"Myotis_brandtii" ;
"Balaenoptera_acutorostrata_scammoni" ;
"Delphinapterus_leucas" ;
"Myotis_davidii" ;
(* "Rhinolophus ferrumequinum" ; in ensembl but not in orthomam *)
]
let%pworkflow convergence_species_tree_pdf ~convergent_species db =
let convergent_species = [%param convergent_species] in
let tree_path = [%path estimated_amino_acid_tree db] in
let open Phylogenetics in
let convergent_species = String.Set.of_list convergent_species in
let render_tree (tree_or_branch : Newick.t) =
let module P = Biotk.Phylo_tree_draw in
let rec of_tree : Newick.tree -> P.tree = function
| Leaf ni ->
let col, text =
match ni.name with
| Some name ->
let col =
if String.Set.mem convergent_species name
then Gg.Color.red else Gg.Color.black
in
col, String.tr ~target:'_' ~replacement:' ' name
| None -> Gg.Color.black, ""
in
P.leaf ~col ~style:`oblique text
| Node n ->
Phylogenetics.List1.map n.branches ~f:of_branch
|> Phylogenetics.List1.to_list
|> P.node
and of_branch : Newick.branch -> P.branch = fun (Branch b) ->
let len = Option.value_exn b.data.length in
let col =
match List.Assoc.find b.data.tags "Condition" ~equal:String.equal with
| Some "1" -> Gg.Color.red
| _ -> Gg.Color.black
in
P.branch ~col len (of_tree b.tip)
in
match tree_or_branch with
| Tree t -> P.draw_tree (of_tree t)
| Branch b -> P.draw_branch (of_branch b)
in
let tree_or_branch =
Newick.from_file tree_path
|> Newick.map_inner_tree ~f:(fun t -> tag_tree t convergent_species)
in
render_tree tree_or_branch
|> Biotk_croquis.Croquis.Layout.simple
|> Fn.flip Biotk_croquis.Croquis.Layout.render_pdf [%dest]
......@@ -66,3 +66,8 @@ val estimated_codon_tree :
val estimated_amino_acid_tree :
Orthomam_db.t ->
newick file
val convergence_species_tree_pdf :
convergent_species:string list ->
Orthomam_db.t ->
pdf file
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