Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 50a9e4b5 authored by Carine Rey's avatar Carine Rey
Browse files

add final sens spe plot

parent c7f806b1
......@@ -265,7 +265,7 @@ let validation_main ~outdir ?(indir = "") ?(ns = 0) ?(np = 2) ?(mem = 2) ~previe
let simu_dataset_l = derive_sim ~tree_dir ~trees ~profile_fn ~preview ~use_concat ~ns ~no_Ne ~no_HaPC in
let post_analyses_simu = Post_analyses.post_analyses_simu_of_simu_dataset_l ~simu_dataset_l in
let repo_of_post_analyses_simu = Post_analyses.repo_of_post_analyses_simu ~post_analyses_simu in
let repo_per_tree_simu = List.map trees ~f:(fun tree ->
let repo_and_post_analyses_per_tree_simu = List.map trees ~f:(fun tree -> (*to keep together all models per tree*)
let trees = [tree] in
let tree_prefix = Filename.chop_extension tree in
let dataset_l =
......@@ -283,9 +283,13 @@ let validation_main ~outdir ?(indir = "") ?(ns = 0) ?(np = 2) ?(mem = 2) ~previe
Repo.shift tree_prefix (Post_analyses.repo_of_post_analyses_res ~prefix:tree_prefix ~post_analyses_res);
] |> List.concat
in
repo_per_tree
) |> List.concat
(repo_per_tree, post_analyses_res)
)
in
let all_repo_per_tree_simu = List.map repo_and_post_analyses_per_tree_simu ~f:(fun (r,p) -> r) |> List.concat in
let all_post_analyses_per_tree = List.map repo_and_post_analyses_per_tree_simu ~f:(fun (r,p) -> p) in
let profile = Filename.chop_extension profile_fn in
let repo_post_analyses_all_trees = Post_analyses.repo_post_analyses_all_trees_of_all_post_analyses_per_tree ~all_post_analyses_per_tree ~profile in
(* real trees *)
let indir_dataset_l = if indir = "" then [] else parse_input_data indir in
let dataset_l = indir_dataset_l in
......@@ -300,7 +304,7 @@ let validation_main ~outdir ?(indir = "") ?(ns = 0) ?(np = 2) ?(mem = 2) ~previe
repo_of_dataset_results_l ~dataset_results_l ;
] |> List.concat
in
let repo = repo_of_post_analyses_simu @ repo_real_trees @ repo_per_tree_simu in
let repo = repo_of_post_analyses_simu @ repo_real_trees @ all_repo_per_tree_simu @repo_post_analyses_all_trees in
Repo.build ~outdir ~np ~mem:(`GB mem) ~logger repo
let simulation_command =
......
......@@ -7,11 +7,13 @@ open File_formats
open Convergence_detection
type post_analyses_dir
type sens_spe_t_choices_plot
type t_choices = {
t_choices_complete: text_file workflow ;
t_choices_max: text_file workflow ;
t_choices_plot: text_file workflow ;
tree_prefix: string;
}
type auto_t_plot = {
......@@ -24,6 +26,7 @@ type auto_t_plot = {
type post_analyses_res = {
t_choices : t_choices option;
auto_t_plot_l : auto_t_plot list option;
dataset_results_l : dataset_res list;
}
type simu_infos = {
......@@ -106,7 +109,8 @@ let get_t_choices ~(dataset_results_l: dataset_res list) : t_choices option =
let t_choices_max = t_choices_dir / selector ["out.max_per_meth.tsv"] in
let t_choices_complete = t_choices_dir / selector ["out.complete.tsv"] in
let t_choices_plot = t_choices_dir / selector ["out.pdf"] in
Some {t_choices_max; t_choices_complete ; t_choices_plot}
let tree_prefix = h0.tree_prefix in
Some {t_choices_max; t_choices_complete ; t_choices_plot; tree_prefix}
| _ -> None
......@@ -144,7 +148,7 @@ let get_simu_infos ~(dataset:Dataset.t) =
let post_analyses_res_of_dataset_results_l ~dataset_results_l =
let t_choices = get_t_choices ~dataset_results_l in
let auto_t_plot_l = plot_det_meth_res_auto_t ~t_choices ~dataset_results_l in
{t_choices; auto_t_plot_l}
{t_choices; auto_t_plot_l;dataset_results_l}
let post_analyses_simu_of_simu_dataset_l ~simu_dataset_l =
let simu_infos_l = List.map simu_dataset_l ~f:(fun dataset ->
......@@ -156,6 +160,60 @@ let post_analyses_simu_of_simu_dataset_l ~simu_dataset_l =
let simu_infos_plot = group_simu_infos ~simu_infos_l / selector ["out.pdf"] in
{simu_infos_l; simu_infos_plot}
let plot_sens_spe_t_choices ~t_choices_l ~dataset_results_l ~profile : sens_spe_t_choices_plot directory workflow =
let env = docker_image ~account:"carinerey" ~name:"r_basics" ~tag:"07162018" () in
let t_choices_dir = tmp // "t_choices_dir" in
let merged_results_dir = tmp // "merged_results_dir" in
let out = dest // "out" in
let cmd_cp_t_choices_l = List.map t_choices_l ~f:(fun t_choices ->
cmd "cp" [dep t_choices.t_choices_max ; t_choices_dir // (t_choices.tree_prefix ^ ".tsv")]
)
in
let cmd_cp_merged_results_l = List.map dataset_results_l ~f:(fun dataset_results ->
cmd "cp" [dep dataset_results.merged_results ; merged_results_dir // (dataset_results.tree_prefix ^"@"^ dataset_results.model_prefix ^ ".tsv")]
)
in
workflow ~descr:"post_analyses.plot_sens_spe_all_trees" [
docker env (
and_list ([
[mkdir_p dest];
[mkdir_p t_choices_dir ];
[mkdir_p merged_results_dir ];
cmd_cp_t_choices_l;
cmd_cp_merged_results_l;
[cmd "Rscript" [
file_dump (string Scripts.plot_sens_spe_all_trees) ;
opt "--input_dir" ident t_choices_dir;
opt "--input_dir2" ident merged_results_dir;
opt "--profil" string profile;
opt "--out " ident out;
];]
]
|> List.concat)
)
]
let repo_post_analyses_all_trees_of_all_post_analyses_per_tree ~profile ~all_post_analyses_per_tree =
let t_choices_l = List.map all_post_analyses_per_tree ~f:(fun post_analyses_res ->
match post_analyses_res.t_choices with
| Some w -> [w]
| None -> []
) |> List.concat
in
let dataset_results_l = List.map all_post_analyses_per_tree ~f:(fun post_analyses_res ->
post_analyses_res.dataset_results_l) |> List.concat
in
let sens_spe_t_choices_plot = plot_sens_spe_t_choices ~t_choices_l ~dataset_results_l ~profile in
Repo.[
item ["sens_spe.pdf"] (sens_spe_t_choices_plot / selector ["out.sens_spe_auto_t.pdf"]);
item ["all_t_choices.pdf"] (sens_spe_t_choices_plot / selector ["out.max_t_per_tree.pdf"]);
item ["sens_spe.tsv"] (sens_spe_t_choices_plot / selector ["out.sens_spe_auto_t.tsv"]);
item ["all_t_choices.tsv"] (sens_spe_t_choices_plot / selector ["out.max_t_per_tree.tsv"]);
]
let repo_of_post_analyses_simu ~post_analyses_simu =
[
Repo.[
......
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