Commit b882da10 authored by Philippe Veber's avatar Philippe Veber

tk/Note: support for croquis

parent 34c1af61
......@@ -250,9 +250,12 @@ module Make (Q : Query) = struct
Biotk.Fasta.from_file alignment_path
|> Base.Result.ok_or_failwith |> snd
in
CS.make ~condition tree alignment site_pos
|> CS.draw |> Biotk_croquis.Croquis.Layout.simple
|> Base.Fn.flip Biotk_croquis.Croquis.Layout.render_pdf dest
let layout =
CS.make ~condition tree alignment site_pos
|> CS.draw
|> Biotk_croquis.Croquis.Layout.simple
in
Biotk_croquis.Croquis.Layout.render `pdf layout (`File dest)
in
Workflow.path_plugin ~descr:"detection_pipeline.view_site" f
......
......@@ -466,9 +466,11 @@ let convergence_species_tree_pdf ~convergent_species db =
Codepitk.Convergence_tree.infer_binary_condition_on_branches
t ~convergent_leaves:convergent_species)
in
render_tree tree_or_branch
|> Biotk_croquis.Croquis.Layout.simple
|> Fn.flip Biotk_croquis.Croquis.Layout.render_pdf dest
let layout =
render_tree tree_or_branch
|> Biotk_croquis.Croquis.Layout.simple
in
Biotk_croquis.Croquis.Layout.render `pdf layout (`File dest)
in
Workflow.path_plugin ~descr:"orthomam.convergence_species_tree_pdf" f
......@@ -589,7 +591,7 @@ let draw_site q pos =
|> Candidate_site.draw
|> Croquis.Layout.simple
in
Croquis.Layout.render_pdf picture dest
Croquis.Layout.render `pdf picture (`File dest)
| Error msg -> failwith msg
in
Workflow.path_plugin ~descr:"orthomam." f
......@@ -5,7 +5,7 @@ type elt =
| Dataframe of Dataframe.t * (string * Dataframe.html_formatter) list
| Png of string
| Svg of string
| Vg of Vg.image
| Croquis of Biotk_croquis.Croquis.Picture.t
type t = {
title : string ;
......@@ -21,7 +21,7 @@ let text x = Text x
let dataframe ?(formatters = []) d = Dataframe (d, formatters)
let png fn = Png fn
let svg fn = Svg fn
let vg i = Vg i
let croquis c = Croquis c
let render_picture format data buf =
let format = match format with
......@@ -39,6 +39,16 @@ let render_dataframe formatters data buf =
Tyxml.Html.pp_elt () fmt (Dataframe.to_html ~formatters data) ;
Format.pp_print_flush fmt ()
let render_croquis croquis buf =
let open Biotk_croquis.Croquis in
let data =
let pic_buf = Buffer.create 253 in
Layout.(render `svg (simple croquis) (`Buffer pic_buf)) ;
Buffer.contents pic_buf
in
render_picture `svg data buf
let header doc =
sprintf {|---
title: %s
......@@ -55,7 +65,7 @@ let render_doc doc =
| Png fn -> render_picture_on_disk `png fn buf
| Svg fn -> render_picture_on_disk `svg fn buf
| Dataframe (data, formatters) -> render_dataframe formatters data buf
| Vg _ -> assert false
| Croquis croquis -> render_croquis croquis buf
) ;
Buffer.add_string buf "\n\n"
) ;
......
......@@ -11,7 +11,7 @@ val dataframe :
val png : string -> elt
val svg : string -> elt
val vg : Vg.image -> elt
val croquis : Biotk_croquis.Croquis.Picture.t -> elt
val make :
?toc:bool ->
......
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