Commit 5b243643 authored by Carine Rey's avatar Carine Rey
Browse files

add a post analyse : simu_infos

parent bfeb4be8
......@@ -33,6 +33,7 @@ let meth_string_of_result = function
type dataset_res = {
model_prefix : string ;
tree_prefix : string ;
dataset : Dataset.t ;
res_by_tools: result list ;
merged_results : text_file workflow ;
plot_merged_results : svg workflow ;
......
......@@ -5,7 +5,6 @@ open Bistro_bioinfo.Std
open File_formats
open Defs
type result = [
| `Pcoc of [`pcoc] directory workflow
| `Pcoc_gamma of [`pcoc] directory workflow
......@@ -24,6 +23,7 @@ val meth_string_of_result : result -> string
type dataset_res = {
model_prefix : string ;
tree_prefix : string ;
dataset : Dataset.t ;
res_by_tools: result list ;
merged_results : text_file workflow ;
plot_merged_results : svg workflow
......
......@@ -15,8 +15,8 @@ let repo ~preview dataset_l =
let repo_ready_data = Ready_dataset.repo dataset.dataset in
let repo_raw_data = if preview then Raw_dataset.repo ~prefix:model_prefix (Ready_dataset.to_raw dataset.dataset) else [] in
List.concat [
Repo.shift "data" (Repo.shift (tree_prefix ^"_"^model_prefix) repo_raw_data);
Repo.shift "debug_data" (Repo.shift tree_prefix (Repo.shift model_prefix repo_ready_data));
Repo.shift "simulated_data" (Repo.shift (tree_prefix ^"_"^model_prefix) repo_raw_data);
Repo.shift "simulated_data_debug" (Repo.shift tree_prefix (Repo.shift model_prefix repo_ready_data));
]
)
|> List.concat
......@@ -217,7 +217,7 @@ let derive_from_dataset ~dataset ~preview ~no_diffsel=
let plot_merged_results = plot_merge_results ~plot_all_sites ~res_by_tools ~tsv ~faa ~tree in
let model_prefix = dataset.model_prefix in
let tree_prefix = dataset.tree_prefix in
{model_prefix; tree_prefix; res_by_tools ; merged_results ; plot_merged_results}
{model_prefix; tree_prefix; dataset; res_by_tools ; merged_results ; plot_merged_results}
let derive_det ~dataset_l ~preview ~no_diffsel =
List.map dataset_l ~f:(fun dataset ->
......
......@@ -8,15 +8,25 @@ open Convergence_detection
type post_analyses_dir
type post_analyses = {
type t_choices = {
t_choices_complete: text_file workflow ;
t_choices_max: text_file workflow ;
t_choices_plot: text_file workflow ;
}
let is_hyp ~hyp dataset_results =
type simu_infos = {
simu_infos: text_file workflow option ;
model_prefix: string ;
}
type post_analyses = {
t_choices : t_choices option;
simu_infos_l : simu_infos list;
}
let is_hyp ~hyp (dataset_results :dataset_res) =
let model_prefix = dataset_results.model_prefix in
let merged_results = dataset_results.merged_results in
model_prefix = hyp
let make_t_choices ~h0_merged_results ~ha_merged_results : post_analyses_dir directory workflow =
......@@ -35,7 +45,19 @@ let make_t_choices ~h0_merged_results ~ha_merged_results : post_analyses_dir dir
])
]
let post_analyses_of_dataset_results_l ~dataset_results_l =
let make_simu_infos ?(descr="") ?(fna_infos) ~faa ~tree_sc : text_file workflow =
let env = docker_image ~account:"carinerey" ~name:"pcoc" ~tag:"07022018" () in
workflow ~descr:("post_analyses.simu_infos." ^ descr) [
cmd "python" ~env [
file_dump (string Scripts.calc_simu_infos) ;
opt "--faa" dep faa;
opt "--tree" dep tree_sc;
option ( opt "--fna_infos" dep) fna_infos;
opt "--output " ident dest;
];
]
let get_t_choices ~(dataset_results_l: dataset_res list) : t_choices option =
let h0_res = List.find dataset_results_l (is_hyp ~hyp: "H0") in
let ha_res = List.find dataset_results_l (is_hyp ~hyp: "HaPCOC") in
match (h0_res, ha_res) with
......@@ -47,14 +69,42 @@ let post_analyses_of_dataset_results_l ~dataset_results_l =
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}
| _ -> failwith {| tata |}
| _ -> None
let get_simu_infos ~dataset_results =
let model_prefix = dataset_results.dataset.model_prefix in
let ready_dataset = dataset_results.dataset.dataset in
let faa = ready_dataset.faa in
let tree_sc = Tree_dataset.tree ready_dataset.tree_dataset `Detection in
let fna_infos = ready_dataset.fna_infos in
match fna_infos with
| Some w -> Some (make_simu_infos ~descr:model_prefix ~faa ~tree_sc ~fna_infos:w)
| None -> None (*make_simu_infos ~faa ~tree_sc*)
let post_analyses_of_dataset_results_l ~dataset_results_l =
let t_choices = get_t_choices ~dataset_results_l in
let simu_infos_l = List.map dataset_results_l ~f:(fun dataset_results ->
{simu_infos = (get_simu_infos ~dataset_results); model_prefix = dataset_results.model_prefix} )in
{t_choices ; simu_infos_l}
let repo_of_post_analyses ~prefix ~post_analyses =
match post_analyses with
[
(match post_analyses.t_choices with
| None -> []
| Some w ->
| Some w ->
Repo.[
item [prefix ^ ".t_choices.max_mcc_per_meth.tsv"] w.t_choices_max ;
item [prefix ^ ".t_choices.complete.tsv"] w.t_choices_complete ;
item [prefix ^ ".t_choices.pdf"] w.t_choices_plot ;
] |> Repo.shift "t_choices"
);
List.map post_analyses.simu_infos_l ~f:(fun simu_infos ->
match simu_infos.simu_infos with
| None -> []
| Some w ->
Repo.[
item [prefix ^ "." ^ simu_infos.model_prefix ^ ".tsv"] w
] |> Repo.shift "simu_infos"
) |> List.concat
] |> List.concat
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