Commit 8f0b1627 authored by Philippe Veber's avatar Philippe Veber
Browse files

further refactoring bppseqgen

parent 5dae0406
......@@ -89,7 +89,7 @@ rate_distribution=Constant()
let conf_file_bppseqgen_multi_profiles ~tree ~profile_f ~ne_c ~ne_a ~hypothesis ~nb_sites_per_profile =
seq ~sep:"\n" (
[
bpp_config_F hypothesis @ [
assign "input.tree.file" (dep tree) ;
assign "input.tree.scale" (int 3) ;
assign "PROFILE_F" (dep profile_f) ;
......@@ -97,8 +97,8 @@ rate_distribution=Constant()
assign "NE_1" (float ne_a) ;
assign "NE_C" (float ne_c) ;
assign "NE_T" (float ne_c) ;
string "" ; (* finish with carriage return *)
]
@ bpp_config_F hypothesis
)
let bppseqgen_multi_profiles_script ~config ~out ~profile_c ~seed =
......@@ -130,31 +130,27 @@ rate_distribution=Constant()
|}
let multi_profiles ?(descr="") ~profile_f ~profile_c ~tree_dataset ~hypothesis ~ne_c ~ne_a ~seed =
let multi_profiles ?(descr="") ~profile_f ~profile_c ~tree_dataset ~hypothesis ~seed =
let nb_sites_per_profile = 1 in
(* let nb_combis = Pervasives.(nb_sites / nb_sites_per_profile) in *)
let config_f = dest // "config.bpp" in
(* let profile_c_ok = tmp // "profiles_c.tsv" in *)
let profile_c_ok = dep profile_c in
let out = dest // "seq.fa" in
let tree = Tree_dataset.tree tree_dataset `Simulation in
let nodes = Tree_dataset.nodes tree_dataset hypothesis in
let ne_g = Convergence_hypothesis.neg_of_model hypothesis in
let ne_c = Convergence_hypothesis.nec_of_model hypothesis in
let ne_a = ne_g in
workflow ~descr:("bppsuite.bppseqgen" ^ descr) [
docker env (
and_list [
mkdir_p dest;
mkdir_p tmp;
cd tmp;
(*cmd "head" ~stdout:profile_c_ok [
opt "-n" int nb_sites;
dep profile_c
];*)
cmd "cat" ~stdout:config_f [
file_dump (conf_file_bppseqgen_multi_profiles ~tree ~profile_f ~hypothesis ~ne_c ~ne_a ~nb_sites_per_profile) ;
file_dump (seq ~sep:"\n" [ string "\n" ]) ;
dep nodes ;
];
cmd "bash" [(file_dump (bppseqgen_multi_profiles_script ~config:config_f ~out ~profile_c:profile_c_ok ~seed))];
cmd "bash" [ file_dump (bppseqgen_multi_profiles_script ~config:config_f ~out ~profile_c:profile_c_ok ~seed)];
]
)
]
......
......@@ -9,8 +9,6 @@ module Bppseqgen : sig
profile_c: text_file workflow ->
tree_dataset:[`tree_dataset] directory workflow ->
hypothesis:Convergence_hypothesis.t ->
ne_c: float ->
ne_a: float ->
seed:int ->
[`bppseqgen] directory workflow
......
......@@ -54,22 +54,13 @@ let calc_fixed_seed ~(str:string) (seed:int) : int =
let derive_from_model ~model ~input_tree ~tree_dataset ~tree_prefix ~profile ~preview ~ns ~seed =
let model_prefix = Convergence_hypothesis.string_of_model model in
let descr = "."^model_prefix^"."^tree_prefix in
(* only 1 profile or 1 couple of profiles*)
(*let config = Convergence_hypothesis.bpp_config nodes model in
let fna = Bppsuite.bppseqgen ~descr ~nb_sites ~tree ~config in
*)
(* with several profiles or couples of profiles *)
let ne_g = neg_of_model model in
let ne_c = nec_of_model model in
let ne_a = ne_g in
let profile_f = profile.profile_f in
let profile_c = profile.profile_c in
(*let seed = Random.int Int.max_value in*)
let seed = calc_fixed_seed ~str:descr seed in
let run_fna = Bppsuite.Bppseqgen.multi_profiles ~descr ~tree_dataset ~hypothesis:model ~profile_f ~profile_c ~ne_c ~ne_a ~seed in
let run_fna = Bppsuite.Bppseqgen.multi_profiles ~descr ~tree_dataset ~hypothesis:model ~profile_f ~profile_c ~seed in
let fna = Bppsuite.Bppseqgen.alignment run_fna in
let fna_infos = Some (Bppsuite.Bppseqgen.info run_fna) in
let faa = Bppsuite.fna2faa ~fna in
let ready_dataset = { Ready_dataset.input_tree = input_tree ; tree_dataset ; fna; faa; fna_infos } in
{ Dataset.model_prefix; is_real= false; tree_prefix; dataset = ready_dataset; seed }
......
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