Commit 2d8a6de2 authored by Philippe Veber's avatar Philippe Veber
Browse files

started alternative pipeline formulation

parent 8f0b1627
open Base
open Printf
open Bistro.EDSL
open File_formats
type dataset =
| Simulation of simulation
and simulation = {
hypothesis : Convergence_hypothesis.t ;
tree : [`NHX of string] ;
profiles : string ;
nb_sites : int ;
seed : int ;
}
let calc_fixed_seed ~(str:string) (seed:int) : int =
let str_hash = Hashtbl.hash str in
Hashtbl.hash (str_hash + seed)
let simulation ~hyp ~tree ~profiles ~nb_sites ~seed =
Simulation {
hypothesis = hyp ;
tree = `NHX tree ;
profiles ;
nb_sites ;
seed ;
}
let tree_prefix = function
| Simulation { tree = `NHX path } ->
Caml.Filename.chop_extension path
let tree_dataset = function
| Simulation { tree = `NHX tree } as sim ->
Tree_dataset.prepare
~descr:("simulated_data." ^ (tree_prefix sim))
(input tree)
let tree = function
| Simulation { tree = `NHX path } -> input path
let profile sim =
Profile.profile_l_of_splitted_profile
~nb_cat:All
~nb_sites:sim.nb_sites
sim.profiles
~seed:(Random.int Int.max_value)
let bppseqgen (Simulation sim as d) =
let model_prefix = Convergence_hypothesis.string_of_model sim.hypothesis in
let descr = sprintf ".%s.%s" model_prefix (tree_prefix d) in
let profile = profile sim in
let profile_f = profile.profile_f in
let profile_c = profile.profile_c in
let seed = calc_fixed_seed ~str:descr sim.seed in
Bppsuite.Bppseqgen.multi_profiles
~descr
~tree_dataset:(tree_dataset d)
~hypothesis:sim.hypothesis ~profile_f ~profile_c ~seed
let nucleotide_alignment (Simulation sim as d) =
bppseqgen d
|> Bppsuite.Bppseqgen.alignment
let phylip_nucleotide_alignment d =
Bppsuite.fna2phy (nucleotide_alignment d)
(* let diffseldsparse d =
* Diffseldsparse.diffseldsparse
* ~alignment:(phylip_nucleotide_alignment d)
* ~tree:(tree d)
* ~w_every:1
* ~n_cycles:2
* () *)
let eval x =
Bistro_utils.Term.(
run ~np:8 ~mem:(`GB 8) ~logger:(Bistro_utils.Console_logger.create ()) (pureW x)
)
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