Commit a5a8fee7 authored by Carine Rey's avatar Carine Rey
Browse files

add different Ne values + some refactoring)

parent a2a5d6e0
......@@ -50,26 +50,27 @@ let bppseqgen ?(descr="") ~nb_sites ~tree ~config : nucleotide_fasta workflow =
let conf_file_bppseqgen_multi_profiles ~tree ~config =
let conf_file_bppseqgen_multi_profiles ~tree ~profile_f ~ne_c ~config ~nb_sites_per_profile =
seq ~sep:"\n" (
[
assign "input.tree.file" (dep tree) ;
assign "PROFILE_F" (dep profile_f) ;
assign "number_of_sites" (int nb_sites_per_profile) ;
assign "NE_1" (int 1 ) ;
assign "NE_C" (float ne_c) ;
assign "NE_T" (float ne_c) ;
]
@ config
)
let bppseqgen_multi_profiles_script ~config ~nb_sites_per_profile ~nb_combis ~out ~profile_f ~ne_c =
let bppseqgen_multi_profiles_script ~config ~nb_combis ~out ~profile_f =
let vars = [
"FINAL_OUT", ident out ;
"PARAM", config ;
"PROFILE_F", dep profile_f ;
"NB_SITES", int nb_sites_per_profile ;
"NB_COMBI_PROFILES", int nb_combis ;
"NE_1", int 1 ;
"NE_C", float ne_c ;
"NE_T", float ne_c ;
]
in
bash_script vars {|
......@@ -84,7 +85,7 @@ let bppseqgen_multi_profiles_script ~config ~nb_sites_per_profile ~nb_combis ~o
shuf -i1-$NB_COLS -n2 -o random_num
COL_M1=`head -n 1 random_num`
COL_M2=`tail -n 1 random_num`
bppseqgen param=$PARAM PROFILE_F=$PROFILE_F i=$i COL_M1=$COL_M1 COL_M2=$COL_M2 number_of_sites=$NB_SITES output.sequence.file=out_int_"$i".fa
bppseqgen param=$PARAM i=$i COL_M1=$COL_M1 COL_M2=$COL_M2 output.sequence.file=out_int_"$i".fa
done
# horizontal concatenation of fasta
......@@ -93,8 +94,7 @@ let bppseqgen_multi_profiles_script ~config ~nb_sites_per_profile ~nb_combis ~o
|}
let bppseqgen_multi_profiles ?(descr="") ~profile_f ~nb_sites ~tree ~config : nucleotide_fasta workflow =
let ne_c = 0.5 in
let bppseqgen_multi_profiles ?(descr="") ~profile_f ~nb_sites ~tree ~config ~ne_c : nucleotide_fasta workflow =
let nb_sites_per_profile = if nb_sites > 100 then 2 else 1 in
let nb_combis = Pervasives.(nb_sites / nb_sites_per_profile) in
let config_f = dest // "config.bpp" in
......@@ -105,8 +105,8 @@ let bppseqgen_multi_profiles ?(descr="") ~profile_f ~nb_sites ~tree ~config : nu
mkdir_p dest;
mkdir_p tmp;
cd tmp;
cmd "cat" ~stdout:config_f [(file_dump (conf_file_bppseqgen_multi_profiles ~tree ~config))];
cmd "bash" [(file_dump (bppseqgen_multi_profiles_script ~config:config_f ~nb_sites_per_profile ~nb_combis ~out ~profile_f ~ne_c))];
cmd "cat" ~stdout:config_f [(file_dump (conf_file_bppseqgen_multi_profiles ~tree ~profile_f ~config ~ne_c ~nb_sites_per_profile))];
cmd "bash" [(file_dump (bppseqgen_multi_profiles_script ~config:config_f ~nb_combis ~out ~profile_f))];
]
)
] / selector ["seq.fa"]
......
......@@ -15,6 +15,7 @@ val bppseqgen_multi_profiles :
nb_sites:int ->
tree:nhx workflow ->
config:Bistro.Template.t list ->
ne_c: float ->
nucleotide_fasta workflow
val fna2faa :
......
......@@ -5,14 +5,18 @@ open Bistro.Std
type t =
| H0
| Ha
| H0Ne
| HaNe
| H0NeSmall
| HaNeSmall
| H0NeBig
| HaNeBig
let string_of_model m = match m with
| H0 -> "H0"
| Ha -> "Ha"
| H0Ne -> "H0Ne"
| HaNe -> "HaNe"
| H0NeSmall -> "H0NeSmall"
| HaNeSmall -> "HaNeSmall"
| H0NeBig -> "H0NeBig"
| HaNeBig -> "HaNeBig"
let assign k v =
seq ~sep:"=" [ string k ; v ]
......@@ -58,8 +62,10 @@ let bpp_config nodes hyp = [
match hyp with
| H0 -> bpp_config_H0
| Ha -> bpp_config_Ha
| H0Ne -> bpp_config_H0_Ne
| HaNe -> bpp_config_Ha_Ne
| H0NeSmall -> bpp_config_H0_Ne
| HaNeSmall -> bpp_config_Ha_Ne
| H0NeBig -> bpp_config_H0_Ne
| HaNeBig -> bpp_config_Ha_Ne
) ;
]
......@@ -94,7 +100,9 @@ let bpp_config_F nodes hyp = [
match hyp with
| H0 -> bpp_config_H0_F
| Ha -> bpp_config_Ha_F
| H0Ne -> bpp_config_H0_F_Ne
| HaNe -> bpp_config_Ha_F_Ne
| H0NeSmall -> bpp_config_H0_F_Ne
| HaNeSmall -> bpp_config_Ha_F_Ne
| H0NeBig -> bpp_config_H0_F_Ne
| HaNeBig -> bpp_config_Ha_F_Ne
;
]
......@@ -18,7 +18,14 @@ let derive_from_model ~model ~tree ~tree_dataset ~tree_prefix ~profile_f ~previe
*)
(* with several profiles or couples of profiles *)
let config_p = Convergence_hypothesis.bpp_config_F nodes model in
let fna = Bppsuite.bppseqgen_multi_profiles ~descr ~nb_sites ~tree ~config:config_p ~profile_f in
let ne_c = match model with
| H0NeSmall -> 0.5
| HaNeSmall -> 0.5
| H0NeBig -> 6.
| HaNeBig -> 6.
| _ -> 1.
in
let fna = Bppsuite.bppseqgen_multi_profiles ~descr ~nb_sites ~tree ~config:config_p ~profile_f ~ne_c in
let faa = Bppsuite.fna2faa ~fna in
let ready_dataset = { Ready_dataset.input_tree = tree ; tree_dataset ; fna; faa} in
......@@ -28,7 +35,14 @@ let derive_from_tree ~tree_dir ~tree ~profile_f ~preview =
let tree_prefix = Filename.chop_extension tree in
let tree = input (Filename.concat tree_dir tree) in
let tree_dataset = Tree_dataset.prepare tree in
let models = Convergence_hypothesis.[H0; Ha; H0Ne; HaNe] in
let models = Convergence_hypothesis.[
H0;
Ha;
H0NeSmall;
HaNeSmall;
H0NeBig ;
HaNeBig ;
] in
List.map models ~f:(fun model ->
derive_from_model ~model ~tree ~tree_dataset ~tree_prefix ~profile_f ~preview
)
......
......@@ -19,8 +19,10 @@ let nodes dataset (model : Convergence_hypothesis.t) =
match model with
| H0 -> [ "tree.H0.node_ids" ]
| Ha -> [ "tree.Ha.node_ids" ]
| H0Ne -> [ "tree.H0_a.node_ids" ]
| HaNe -> [ "tree.Ha.node_ids" ]
| H0NeSmall -> [ "tree.H0_a.node_ids" ]
| HaNeSmall -> [ "tree.Ha.node_ids" ]
| H0NeBig -> [ "tree.H0_a.node_ids" ]
| HaNeBig -> [ "tree.Ha.node_ids" ]
)
let tree dataset mode =
......
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