reviewphiltrans_app.ml 3.4 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
let realdata_main ~use_diffsel
                  ~use_pcoc
                  ~use_pcoc_c60
                  ~use_pcoc_gamma
                  ~use_topological
                  ~use_identical
                  ~no_use_multinomial
19 20
                  ~calc_dnds
                  ~calc_gene_trees
21 22 23 24
                  ~indir ~outdir ~np ~mem () =
  let loggers = [
      Console_logger.create () ;
  ] in
25 26 27 28 29 30
  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
31
  let use_multinomial = not no_use_multinomial in
32 33
  let meths = List.filter_opt [
      sw use_diffsel `Diffsel ;
34
      sw use_pcoc `Pcoc ;
Carine Rey's avatar
Carine Rey committed
35
      sw use_pcoc_c60 `Pcoc_C60 ;
36 37 38 39
      sw use_pcoc_gamma `Pcoc_gamma ;
      sw use_topological `Topological ;
      sw use_identical `Identical ;
      sw use_multinomial `Multinomial ;
40 41
    ]
  in
42 43 44 45 46
  let pal  = List.filter_opt [
    sw calc_dnds `DnDs;
    sw calc_gene_trees `GeneTree;
    ]
  in
47 48
  List.concat [
    Repo.shift "Merged_results" (Real_dataset.repo meths rd) ;
49
    Repo.shift "PreParsed_Dataset" (Real_dataset.repo_parsed_rd pal rd);
50
    ]
51
  |> Bistro_utils.Repo.build_main ~outdir ~loggers ?np ?mem
52 53 54 55 56 57 58 59 60 61

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"
62 63
      and use_diffsel =
        flag "--diffsel" no_arg ~doc:" use the diffsel method (very slow)."
64 65 66
      and use_pcoc =
        flag "--pcoc" no_arg ~doc:" use the pcoc method (slow)."
      and use_pcoc_c60 =
67
        flag "--pcoc-c60" no_arg ~doc:" use the pcoc method with c60 profils (very_slow)."
68
      and use_pcoc_gamma =
69
        flag "--pcoc-gamma" no_arg ~doc:" use the pcoc method with the gamma option (very_slow)."
70 71 72 73 74 75
      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)."
76 77 78 79
      and calc_dnds =
          flag "--dnds" no_arg ~doc:" calculate dn ds dnds trees (slow)."
      and calc_gene_trees =
          flag "--gt" no_arg ~doc:" calculate gene trees (slow)."
80 81 82 83 84
      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
85 86 87 88 89 90 91
      realdata_main ~use_diffsel
                    ~use_pcoc
                    ~use_pcoc_c60
                    ~use_pcoc_gamma
                    ~use_topological
                    ~use_identical
                    ~no_use_multinomial
92 93
                    ~calc_dnds
                    ~calc_gene_trees
94
                    ~indir ~outdir ~np ~mem
95 96
    ]

Philippe Veber's avatar
Philippe Veber committed
97 98
let () =
  Command.group ~summary:"Reviewphiltrans" [
Philippe Veber's avatar
Philippe Veber committed
99
    "validation", Pipeline.validation_command ;
100
    "realdata", realdata_command ;
101
    "alistats", Alistats.command ;
Philippe Veber's avatar
Philippe Veber committed
102 103
  ]
  |> Command.run