Commit 770c40a2 authored by Philippe Veber's avatar Philippe Veber
Browse files

Pipeline2: mixed H0/HaPC bppseqgen simulations

parent fef0ec27
......@@ -16,8 +16,17 @@ type dataset =
nb_sites : int ;
seed : int ;
}
| Bppseqgen_mixed of {
tree : [`NHX of string] ;
profiles : string ;
seed : int ;
n_h0 : int ;
n_ha : int ;
ne_s : float ;
}
| Convdet_simulation of {
tree : [`NHX of string] ;
branch_factor : float ;
profiles : string ;
n_h0 : int ;
n_ha : int ;
......@@ -35,11 +44,13 @@ let bppseqgen_simulation ~hyp ~tree ~profiles ~nb_sites ~seed =
let tree_prefix = function
| Bppseqgen_simulation { tree = `NHX path ; _ }
| Bppseqgen_mixed { tree = `NHX path ; _ }
| Convdet_simulation { tree = `NHX path ; _ } ->
Caml.Filename.chop_extension path
let tree_dataset = function
| Bppseqgen_simulation { tree = `NHX tree ; _ }
| Bppseqgen_mixed { tree = `NHX tree ; _ }
| Convdet_simulation { tree = `NHX tree ; _ } as sim ->
Tree_dataset.prepare
~descr:("simulated_data." ^ (tree_prefix sim))
......@@ -47,6 +58,7 @@ let tree_dataset = function
let tree = function
| Bppseqgen_simulation { tree = `NHX path ; _ }
| Bppseqgen_mixed { tree = `NHX path ; _ }
| Convdet_simulation { tree = `NHX path ; _ } ->
Workflow.input path
......@@ -69,14 +81,18 @@ let bppseqgen sim ~hypothesis ~nb_sites ~profiles ~seed =
~tree_dataset:(tree_dataset sim)
~hypothesis ~profile_f ~profile_c ~seed
let nucleotide_alignment = function
let rec nucleotide_alignment = function
| Bppseqgen_simulation { hypothesis ; nb_sites ; profiles ; seed ; _ } as sim ->
bppseqgen sim ~hypothesis ~nb_sites ~profiles ~seed
|> Bppsuite.Bppseqgen.alignment
| Convdet_simulation { n_h0 ; n_ha ; profiles ; ne_s ; _ } as sim ->
| Bppseqgen_mixed { profiles ; seed ; n_h0 ; n_ha ; ne_s ; tree } ->
let h0 = nucleotide_alignment (Bppseqgen_simulation { hypothesis = H0 (Fixed ne_s) ; profiles ; seed ; nb_sites = n_h0 ; tree }) in
let ha = nucleotide_alignment (Bppseqgen_simulation { hypothesis = HaPC (Fixed ne_s) ; profiles ; seed ; nb_sites = n_ha ; tree }) in
Utils.fasta_cappend h0 ha
| Convdet_simulation { n_h0 ; n_ha ; profiles ; ne_s ; branch_factor ; _ } as sim ->
let tree = tree sim in
let fitness_profiles = Workflow.input profiles in
Simulator.simulator ~n_ha ~n_h0 ~ne_s ~tree ~fitness_profiles
Simulator.simulator ~branch_factor ~n_ha ~n_h0 ~ne_s ~tree ~fitness_profiles ()
let amino_acid_alignment d = Bppsuite.fna2faa (nucleotide_alignment d)
......@@ -126,6 +142,7 @@ let oracle d =
| H0 _ -> nb_sites, 0
| HaPC _ | HaPCOC _ -> 0, nb_sites
)
| Bppseqgen_mixed { n_h0 ; n_ha ; _ }
| Convdet_simulation { n_h0 ; n_ha ; _ } -> n_h0, n_ha
in
Convergence_detection.oracle ~n_h0 ~n_ha
......
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