Commit 5379230d authored by Carine Rey's avatar Carine Rey
Browse files

refactoring

parent 1b01ac9a
......@@ -28,7 +28,7 @@ type dataset_res = {
let pcoc ?plot_complete ?gamma ~(faa:aminoacid_fasta workflow) ~(tree:_ workflow) : (*`pcoc TODO*) det_out directory workflow =
let env = docker_image ~account:"carinerey" ~name:"pcoc" ~tag:"06212018" () in
let run_pcoc = workflow ~descr:"convergence_detection.pcoc" [
workflow ~descr:"convergence_detection.pcoc" [
cmd "pcoc_det.py" ~env [
opt "-t" dep tree;
opt "-m" string "-";
......@@ -37,7 +37,10 @@ let pcoc ?plot_complete ?gamma ~(faa:aminoacid_fasta workflow) ~(tree:_ workflo
option ( flag string "--gamma" ) gamma;
option ( flag string "--plot --plot_complete_ali" ) plot_complete;
]
] (* TODO / selector ["RUN*/*.results.tsv"] *) in
]
let pcoc_selector (run_pcoc:det_out directory workflow) : text_file workflow =
let out_pcoc = (dep run_pcoc) // "RUN*/*.results.tsv" in
workflow ~descr:"convergence_detection.selector_pcoc" [
cmd "cp" [out_pcoc; ident dest] ;
......@@ -46,20 +49,39 @@ let pcoc ?plot_complete ?gamma ~(faa:aminoacid_fasta workflow) ~(tree:_ workflo
let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:int) ~(n_cycles: int) : (*`diffsel TODO*) det_out directory workflow =
let env = docker_image ~account:"vlanore" ~name:"diffsel" ~tag:"v1.0" () in
let tmp_tree = tmp // "myrun.tree" in
let tmp_ali = tmp // "myrun.ali" in
let dest_tree = dest // "myrun.tree" in
let dest_ali = dest // "myrun.ali" in
let chainname = dest // "myrun" in
(*_build/diffsel -t data/samhd1.tree -d data/samhd1.ali -ncond 3 -x 1 10000 myrun*)
let run_diffsel = workflow ~descr:"convergence_detection.run_diffsel" [
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];
ident chainname ;
];
] in
workflow ~descr:"convergence_detection.run_diffsel" [
docker env (
and_list [
mkdir_p dest;
cmd "cp" [dep phy_n; dest_ali]; (* required dep to link the file in the env *)
cmd "cp" [dep tree; dest_tree]; (* required dep to link the file in the env *)
cmd "cp" [dep phy_n; tmp_ali]; (* required dep to link the file in the env *)
cmd "cp" [dep tree; tmp_tree]; (* required dep to link the file in the env *)
cmd "/diffsel/_build/diffsel" [
opt "-t" ident tmp_tree;
opt "-d" ident tmp_ali ;
opt "-ncond" int 2 ;
opt "-x" seq [ int w_every; string " "; int n_cycles];
ident chainname ;
];
]
)
]
let diffsel_selector run_diffsel : text_file workflow =
let env = docker_image ~account:"vlanore" ~name:"diffsel" ~tag:"v1.0" () in
let package = tmp // "diffsel_script_utils.py" in
let script = tmp // "diffsel_analyze_result.py" in
let tmp_tree = tmp // "myrun.tree" in
let tmp_ali = tmp // "myrun.ali" in
let dep_tree = (dep run_diffsel) // "myrun.tree" in
let dep_ali = (dep run_diffsel) // "myrun.ali" in
let chainname = (dep run_diffsel) // "myrun" in
let out = dest in
workflow ~descr:"convergence_detection.parse_diffsel" [
......@@ -68,8 +90,9 @@ let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:in
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 *)
cmd "cp" [dep_ali; tmp_ali]; (* required dep to link the file in the env *)
cmd "cp" [dep_tree; tmp_tree]; (* required dep to link the file in the env *)
(*python diffsel_analyze_result.py [-r /path/to/readdiffsel] [-o output_file] chainname *)
cmd "cp" [ file_dump (string Scripts.diffsel_script_utils) ; package] ;
......@@ -91,9 +114,9 @@ let merge_results ~res_by_tools : text_file workflow =
let command = List.map res_by_tools ~f:(fun res ->
let def_meth = res.det_meth in
let w = match def_meth with
| Pcoc -> res.det_result
| Pcoc_gamma -> res.det_result
| Diffsel -> res.det_result
| Pcoc -> pcoc_selector res.det_result
| Pcoc_gamma -> pcoc_selector res.det_result
| Diffsel -> diffsel_selector res.det_result
in
let opt = match def_meth with
| Pcoc -> string "--pcoc"
......
......@@ -33,6 +33,10 @@ val pcoc :
tree : _ workflow ->
(*[`pcoc]*) det_out directory workflow
val pcoc_selector :
(*[`pcoc]*) det_out directory workflow ->
text_file workflow
val diffsel :
phy_n : nucleotide_phylip workflow ->
tree : _ workflow ->
......@@ -40,6 +44,9 @@ val diffsel :
n_cycles: int ->
(*[`diffsel]*) det_out directory workflow
val diffsel_selector :
(*[`diffsel]*) det_out directory workflow ->
text_file workflow
val merge_results :
res_by_tools : det_result list ->
......
......@@ -105,11 +105,17 @@ let repo_of_dataset_results_l ~dataset_results_l =
in
let repo_d = Repo.shift "Detection_tools" (Repo.shift det_meth_prefix (
Repo.[
match det_meth with
| Pcoc -> item ["pcoc.results.tsv"] w
| Pcoc_gamma -> item ["pcoc_gamma.results.tsv"] w
| Diffsel -> item ["diffsel.results.tsv"] w
]
[match det_meth with
| Pcoc -> item ["pcoc.results.tsv"] (pcoc_selector w)
| Pcoc_gamma -> item ["pcoc_gamma.results.tsv"] (pcoc_selector w)
| Diffsel -> item ["diffsel.results.tsv"] (diffsel_selector w)
];
[match det_meth with
| Pcoc -> item ["raw_results"] w
| Pcoc_gamma -> item ["raw_results"] w
| Diffsel -> item ["raw_results"] w
] ;
] |> List.concat
))
in
repo_d
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment