Commit 30e06eb7 authored by Carine Rey's avatar Carine Rey
Browse files

start the results merging step

parent 8da43ac3
......@@ -3,6 +3,7 @@ open Bistro.EDSL
open Bistro.Std
open File_formats
open Bistro_bioinfo.Std
open Defs
type pcoc_out
type diffsel_out
......@@ -11,6 +12,19 @@ type det_out =
| Pcoc_out
| Diffsel_out
type det_result = {
dataset : dataset ;
det_meth : det_meth ;
det_result : det_out directory workflow ;
}
type dataset_res = {
model_prefix : string ;
tree_prefix : string ;
res_by_tools: det_result list ;
merged_results : text_file workflow
}
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" [
......@@ -69,3 +83,30 @@ let diffsel ~(phy_n:nucleotide_phylip workflow) ~(tree: _ workflow) ~(w_every:in
]
)
]
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
in
let opt = match def_meth with
| Pcoc -> string "--pcoc"
| Pcoc_gamma -> string "--pcoc_gamma"
| Diffsel -> string "--diffsel"
in
seq ~sep:" " [opt; dep w]
)
in
workflow ~descr:"convergence_detection.merge_results" [
cmd "python" [
file_dump (string Scripts.merge_det_results) ;
opt "-o" ident dest ;
seq ~sep:" " command ;
] ;
]
......@@ -3,6 +3,7 @@ open Bistro.EDSL
open Bistro.Std
open Bistro_bioinfo.Std
open File_formats
open Defs
type pcoc_out
type diffsel_out
......@@ -11,6 +12,19 @@ type det_out =
| Pcoc_out
| Diffsel_out
type det_result = {
dataset : dataset ;
det_meth : det_meth ;
det_result : det_out directory workflow ;
}
type dataset_res = {
model_prefix : string ;
tree_prefix : string ;
res_by_tools: det_result list ;
merged_results : text_file workflow
}
val pcoc :
?plot_complete : bool ->
?gamma : bool ->
......@@ -24,3 +38,8 @@ val diffsel :
w_every : int ->
n_cycles: int ->
(*[`diffsel]*) det_out directory workflow
val merge_results :
res_by_tools : det_result list ->
text_file workflow
......@@ -33,7 +33,6 @@ type dataset = {
ready_dataset : ready_dataset
}
type det_meth =
| Pcoc
| Pcoc_gamma
......@@ -49,14 +48,5 @@ type 'a w_det_meth =
| Pcoc_gamma_w of 'a
| Diffsel of 'a
type det_result = {
dataset : dataset ;
det_meth : det_meth ;
det_result : Convergence_detection.det_out directory workflow ;
}
type dataset_res = {
res_by_tools: det_result list ;
merged_results : string
}
......@@ -4,6 +4,7 @@ open Bistro.EDSL
open Bistro.Std
open File_formats
open Defs
open Convergence_detection
let ready_dataset_of_raw_dataset raw_dataset =
let input_tree = raw_dataset.input_tree in
......@@ -39,7 +40,7 @@ let repo_of_raw_dataset (raw_dataset:raw_dataset) =
let repo_of_dataset_l ~preview dataset_l =
List.map dataset_l ~f:(fun dataset ->
List.map dataset_l ~f:(fun (dataset : Defs.dataset) ->
let model_prefix = dataset.model_prefix in
let tree_prefix = dataset.tree_prefix in
let w_dataset =
......@@ -91,12 +92,15 @@ let derive_sim ~tree_dir ~trees ~profile_fn ~preview =
let repo_of_dataset_results_l ~dataset_results_l =
List.map dataset_results_l ~f:(fun dataset_results ->
let det_results_l = dataset_results.res_by_tools in
let merged_results = dataset_results.merged_results in
let merged_results_item = Repo.shift dataset_results.tree_prefix (Repo.shift dataset_results.model_prefix [(Repo.item ["merged_results.tsv"] merged_results) ]) in
[ merged_results_item ;
List.map det_results_l ~f:(fun det_results ->
let model_prefix = det_results.dataset.model_prefix in
let tree_prefix = det_results.dataset.tree_prefix in
let det_meth = det_results.det_meth in
let det_meth_prefix = string_of_det_meth det_meth in
let open Convergence_detection in
let w = det_results.det_result
in
let repo_d = Repo.shift "Detection_tools" (Repo.shift det_meth_prefix (
......@@ -110,11 +114,11 @@ let repo_of_dataset_results_l ~dataset_results_l =
in
Repo.shift tree_prefix (Repo.shift model_prefix repo_d)
) |> List.concat
] |> List.concat
)
|> List.concat
let derive_from_det_meth ~det_meth ~dataset ~preview =
let open Convergence_detection in
let faa = dataset.ready_dataset.faa in
let fna = dataset.ready_dataset.fna in
let phy_n = Bppsuite.fa2phy ~fna in
......@@ -132,13 +136,15 @@ let derive_from_det_meth ~det_meth ~dataset ~preview =
let derive_from_dataset ~dataset ~preview=
let derive_from_dataset ~dataset ~preview =
let det_meths = [Pcoc;Pcoc_gamma;Diffsel] in
let res_by_tools = List.map det_meths ~f:(fun det_meth ->
derive_from_det_meth ~det_meth ~dataset ~preview
) in
let merged_results = "" (* TODO: replace "" by a workflow *) in
{res_by_tools; merged_results}
let merged_results = merge_results ~res_by_tools in
let model_prefix = dataset.model_prefix in
let tree_prefix = dataset.tree_prefix in
{model_prefix; tree_prefix; res_by_tools ; merged_results}
let derive_det ~dataset_l ~profile_fn ~preview=
List.map dataset_l ~f:(fun dataset ->
......
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