wip.ml 2.02 KB
Newer Older
Louis Duchemin's avatar
Louis Duchemin committed
1 2
let db = Codepitk.Orthomam_db.make "/home/louis/Data/omm/"

3 4
let echolocators = Bistro.Workflow.data Codepi.Orthomam.species_with_echolocation

5
let subterraneans = 
6 7 8
  Bistro.Workflow.input "/home/louis/dev/codepi/data/subterranean.tsv"
  |> Codepi.Orthomam.Binary_phenotype.load_convergent_species

9 10
let marines = 
  Bistro.Workflow.input "/home/louis/dev/codepi/data/orthomam_marine.tsv"
11 12
  |> Codepi.Orthomam.Binary_phenotype.load_convergent_species

13 14
let pipeline ~phenotypes =
  Codepi.Orthomam.rer_converge ~db ~phenotypes ()
Louis Duchemin's avatar
Louis Duchemin committed
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29
module Top = Bistro_utils.Toplevel_eval.Make(struct
    let np = 10
    let mem = 8 
  end)()

let result_table_script targets =
  let open Codepi.R_console in
  let assignments = 
    List.map (fun (clade, target) ->
      path (Codepi.Rer_converge.string_of_clade clade) Codepi.Orthomam.(target.result_table)
    ) targets
  in 
  rconsole (module Top) "library(tidyverse)" assignments

Louis Duchemin's avatar
Louis Duchemin committed
30
let () =
31 32 33
    result_table_script (pipeline ~phenotypes:subterraneans)

let main () =
34 35 36
  try
    let loggers = [ Bistro_utils.Console_logger.create () ] in
    let allowed_containers = [ `Docker ] in
37
    let execute workflow = 
38 39 40 41 42 43
      Bistro.Workflow.path workflow
      |> Bistro_engine.Scheduler.simple_eval_exn ~allowed_containers ~np:10
        ~mem:(`GB 8) ~loggers
      |> print_endline 
    in
    List.iter2 (fun label phenotypes -> 
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        pipeline ~phenotypes
        |> List.iter  (fun (clade, target) -> 
            print_endline label;

            print_endline ("Foreground clade : " ^ (Codepi.Rer_converge.string_of_clade clade));

            print_string "Result table : ";
            execute Codepi.Orthomam.(target.result_table);

            print_string "RER plots : ";
            execute (target.rer_plot ~pat:"*LIM2*");

            print_string "Candidates summary : ";
            execute target.best_candidate_summary;
          )
59
      ) 
60
      ["Subterraneans"; "Marines"]
61
      (* ; "Marines "; "Echolocators"]  *)
62 63
      [subterraneans; marines]
  (* ; marines; echolocators] *)
64
  with Failure msg -> print_endline msg
65