reviewphiltrans_app.ml 3.17 KB
Newer Older
Philippe Veber's avatar
Philippe Veber committed
1 2
open Core
open Reviewphiltrans
3 4
open Bistro_utils

Philippe Veber's avatar
Philippe Veber committed
5

6 7 8 9
let first_nhx_in_dir dir =
  Sys.readdir dir
  |> Array.find_exn ~f:(String.is_suffix ~suffix:".nhx")

10 11
let sw b x = if b then Some x else None

12 13 14 15 16 17 18 19 20 21 22
let realdata_main ~use_diffsel
                  ~use_pcoc
                  ~use_pcoc_c60
                  ~use_pcoc_gamma
                  ~use_topological
                  ~use_identical
                  ~no_use_multinomial
                  ~indir ~outdir ~np ~mem () =
  let loggers = [
      Console_logger.create () ;
  ] in
23 24 25 26 27 28
  let mem = Option.map mem ~f:(fun i -> `GB i) in
  let rd =
    Real_dataset.make
      ~alignment_dir_path:(Filename.concat indir "Alignments")
      ~tree_path:(Filename.concat indir (first_nhx_in_dir indir))
  in
29
  let use_multinomial = not no_use_multinomial in
30 31
  let meths = List.filter_opt [
      sw use_diffsel `Diffsel ;
32
      sw use_pcoc `Pcoc ;
Carine Rey's avatar
Carine Rey committed
33
      sw use_pcoc_c60 `Pcoc_C60 ;
34 35 36 37
      sw use_pcoc_gamma `Pcoc_gamma ;
      sw use_topological `Topological ;
      sw use_identical `Identical ;
      sw use_multinomial `Multinomial ;
38 39
    ]
  in
40 41 42 43
  List.concat [
    Repo.shift "Merged_results" (Real_dataset.repo meths rd) ;
    Repo.shift "PreParsed_Dataset" (Real_dataset.repo_parsed_rd rd);
    ]
44
  |> Bistro_utils.Repo.build_main ~outdir ~loggers ?np ?mem
45 46 47 48 49 50 51 52 53 54

let realdata_command =
  let open Command.Let_syntax in
  Command.basic
    ~summary:"Run pipeline on real data"
    [%map_open
      let outdir =
        flag "--outdir" (required string) ~doc:"PATH Output directory"
      and indir =
        flag "--indir" (required string) ~doc:"PATH Input directory"
55 56
      and use_diffsel =
        flag "--diffsel" no_arg ~doc:" use the diffsel method (very slow)."
57 58 59
      and use_pcoc =
        flag "--pcoc" no_arg ~doc:" use the pcoc method (slow)."
      and use_pcoc_c60 =
60
        flag "--pcoc-c60" no_arg ~doc:" use the pcoc method with c60 profils (very_slow)."
61
      and use_pcoc_gamma =
62
        flag "--pcoc-gamma" no_arg ~doc:" use the pcoc method with the gamma option (very_slow)."
63 64 65 66 67 68
      and use_topological =
        flag "--topological" no_arg ~doc:" use the topological method (fast)."
      and use_identical =
        flag "--identical" no_arg ~doc:" use the identical method (fast)."
      and no_use_multinomial =
        flag "--no-multinomial" no_arg ~doc:" not use the multinomial method (very fast so by default)."
69 70 71
      (* and preview =
       *   flag "--preview-mode" no_arg ~doc:" Preview mode"
       * and calc_dnds =
72
       *   flag "--dnds" no_arg ~doc:" calculate dn ds dnds trees (slow)."*)
73 74 75 76 77
      and np =
        flag "--np" (optional int) ~doc:"INT Number of available processors"
      and mem =
        flag "--mem" (optional int) ~doc:"INT Available memory (in GB)"
      in
78 79 80 81 82 83 84 85
      realdata_main ~use_diffsel
                    ~use_pcoc
                    ~use_pcoc_c60
                    ~use_pcoc_gamma
                    ~use_topological
                    ~use_identical
                    ~no_use_multinomial
                    ~indir ~outdir ~np ~mem
86 87
    ]

Philippe Veber's avatar
Philippe Veber committed
88 89
let () =
  Command.group ~summary:"Reviewphiltrans" [
Philippe Veber's avatar
Philippe Veber committed
90
    "validation", Pipeline.validation_command ;
91
    "realdata", realdata_command ;
92
    "alistats", Alistats.command ;
Philippe Veber's avatar
Philippe Veber committed
93 94
  ]
  |> Command.run