convergence_detection.ml 2.52 KB
Newer Older
Carine Rey's avatar
Carine Rey committed
1
open Core
Carine Rey's avatar
Carine Rey committed
2 3 4 5 6 7 8 9 10 11 12 13
open Bistro.EDSL
open Bistro.Std
open File_formats
open Bistro_bioinfo.Std

type pcoc_out
type diffsel_out

type det_out =
  | Pcoc_out
  | Diffsel_out

Carine Rey's avatar
Carine Rey committed
14
let pcoc ?plot_complete ?gamma  ~(faa:aminoacid_fasta workflow) ~(tree:_ workflow) :  (*`pcoc TODO*) det_out directory workflow =
Carine Rey's avatar
Carine Rey committed
15
  let env = docker_image ~account:"carinerey" ~name:"pcoc" ~tag:"06212018" () in
Carine Rey's avatar
Carine Rey committed
16
  let run_pcoc = workflow ~descr:"convergence_detection.pcoc" [
Carine Rey's avatar
Carine Rey committed
17 18 19 20 21 22
    cmd "pcoc_det.py" ~env [
        opt "-t" dep tree;
        opt "-m" string "-";
        opt "-aa"  dep faa ;
        opt "-o"  ident dest ;
        option ( flag string "--gamma" ) gamma;
23
        option ( flag string "--plot --plot_complete_ali" ) plot_complete;
Carine Rey's avatar
Carine Rey committed
24
    ]
Carine Rey's avatar
Carine Rey committed
25 26 27 28 29
  ] (* TODO / selector ["RUN*/*.results.tsv"] *) in
  let out_pcoc = (dep run_pcoc) // "RUN*/*.results.tsv" in
  workflow ~descr:"convergence_detection.selector_pcoc" [
    cmd "cp" [out_pcoc; ident dest] ;
  ]
Carine Rey's avatar
Carine Rey committed
30 31


Carine Rey's avatar
Carine Rey committed
32
let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:int) ~(n_cycles: int) :  (*`diffsel TODO*) det_out directory workflow =
Carine Rey's avatar
Carine Rey committed
33
  let env = docker_image ~account:"vlanore" ~name:"diffsel" ~tag:"v1.0" () in
Carine Rey's avatar
Carine Rey committed
34
  let chainname = dest // "myrun" in
Carine Rey's avatar
Carine Rey committed
35
  (*_build/diffsel -t data/samhd1.tree -d data/samhd1.ali -ncond 3 -x 1 10000 myrun*)
Carine Rey's avatar
Carine Rey committed
36
  let run_diffsel = workflow ~descr:"convergence_detection.run_diffsel" [
Carine Rey's avatar
Carine Rey committed
37 38 39 40 41 42
    mkdir_p dest;
    cmd "_build/diffsel" ~env [
        opt "-t" dep tree;
        opt "-d"  dep phy_n ;
        opt "-ncond"  int 2 ;
        opt "-x" seq [ int w_every; string " "; int n_cycles];
Carine Rey's avatar
Carine Rey committed
43
        ident chainname ;
Carine Rey's avatar
Carine Rey committed
44
    ];
Carine Rey's avatar
Carine Rey committed
45 46 47
  ] in
  let package = tmp // "diffsel_script_utils.py" in
  let script = tmp // "diffsel_analyze_result.py" in
Carine Rey's avatar
Carine Rey committed
48
  let chainname = (dep run_diffsel) // "myrun" in
Carine Rey's avatar
Carine Rey committed
49
  let out = dest in
Carine Rey's avatar
Carine Rey committed
50 51 52
  workflow ~descr:"convergence_detection.parse_diffsel" [
    docker env (
      and_list [
Carine Rey's avatar
Carine Rey committed
53 54 55 56 57 58
        mkdir_p tmp ;
        cd tmp ;
        cmd "ls" [dep run_diffsel];
        cmd "ls" [dep phy_n]; (* required dep to link the file in the env *)
        cmd "ls" [dep tree]; (* required dep to link the file in the env *)

Carine Rey's avatar
Carine Rey committed
59
        (*python diffsel_analyze_result.py [-r /path/to/readdiffsel] [-o output_file] chainname *)
Carine Rey's avatar
Carine Rey committed
60
        cmd "cat" ~stdout:package [ file_dump (string Scripts.diffsel_script_utils) ] ;
Carine Rey's avatar
Carine Rey committed
61
        cmd "cat" ~stdout:script [ file_dump (string Scripts.diffsel_analyze_result) ] ;
Carine Rey's avatar
Carine Rey committed
62

Carine Rey's avatar
Carine Rey committed
63 64
        cmd "python" [
          string "diffsel_analyze_result.py" ;
Carine Rey's avatar
Carine Rey committed
65 66 67
          opt "-r" string "/diffsel/_build/readdiffsel" ;
          opt "-o" ident out ;
          ident chainname ;
Carine Rey's avatar
Carine Rey committed
68 69 70
        ]
      ]
    )
Carine Rey's avatar
Carine Rey committed
71
  ]