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

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

8 9 10
let sw b x = if b then Some x else None

let realdata_main ~use_diffsel ~indir ~outdir ~np ~mem () =
11 12 13 14 15 16
  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
17 18 19 20 21 22
  let meths = List.filter_opt [
      sw use_diffsel `Diffsel ;
      Some `Multinomial ;
    ]
  in
  Real_dataset.repo meths rd
23 24 25 26 27 28 29 30 31 32 33
  |> Bistro_utils.Repo.build_main ~outdir ?np ?mem

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"
34 35
      and use_diffsel =
        flag "--diffsel" no_arg ~doc:" use the diffsel method (very slow)."
36 37 38 39 40 41 42 43 44 45 46 47 48
      (* and preview =
       *   flag "--preview-mode" no_arg ~doc:" Preview mode"
       * and use_diffsel =
       *   flag "--diffsel" no_arg ~doc:" use the diffsel method (very slow)."
       * and use_c60 =
       *   flag "--c60" no_arg ~doc:" use the pcoc c60 method (slow)."
       * and calc_dnds =
       *   flag "--dnds" no_arg ~doc:" calculate dn ds dnds trees (slow)." *)
      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
49
      realdata_main ~use_diffsel ~indir ~outdir ~np ~mem
50 51
    ]

Philippe Veber's avatar
Philippe Veber committed
52 53
let () =
  Command.group ~summary:"Reviewphiltrans" [
Philippe Veber's avatar
Philippe Veber committed
54
    "validation", Pipeline.validation_command ;
55
    "realdata", realdata_command ;
56
    "alistats", Alistats.command ;
Philippe Veber's avatar
Philippe Veber committed
57 58
  ]
  |> Command.run