Commit 25fa66f4 authored by Philippe Veber's avatar Philippe Veber
Browse files

refactoring on convergence_hypothesis

parent 25efcb37
open Core
open Bistro.EDSL
open Bistro.Std
type t =
| H0
| Ha
let string_of_model m = match m with
| H0 -> "H0"
| Ha -> "Ha"
let bpp_config = function
| H0 -> {|\
alphabet=Codon(letter=DNA)
genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
nonhomogeneous.number_of_models = 1
model1=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C1(nbCat=10)))
model1.nodes_id=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
nonhomogeneous.root_freq=Fixed()
rate_distribution=Constant()
|};
| Ha -> {|\
alphabet=Codon(letter=DNA)
genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
nonhomogeneous.number_of_models = 2
model1=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C1(nbCat=10)))
model1.nodes_id=15,1,13,14,4
model2=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C7(nbCat=10)))
model2.nodes_id=0,2,3,5,6,7,8,9,10,11,12,16,17
nonhomogeneous.root_freq=Fixed()
rate_distribution=Constant()
|};
open Core
open Bistro_utils
open Bistro.EDSL
open Bistro.Std
open File_formats
type model =
|H0
|Ha
let string_of_model m = match m with
| H0 -> "H0"
| Ha -> "Ha"
let define_bpp_config_of_model m = match m with
| H0 -> {|alphabet=Codon(letter=DNA)
genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
nonhomogeneous.number_of_models = 1
model1=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C1(nbCat=10)))
model1.nodes_id=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
nonhomogeneous.root_freq=Fixed()
rate_distribution=Constant()
|};
| Ha -> {|alphabet=Codon(letter=DNA)
genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
nonhomogeneous.number_of_models = 2
model1=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C1(nbCat=10)))
model1.nodes_id=15,1,13,14,4
model2=Codon_AAFit(model=K80, fitness=FromModel(model=LGL08_CAT_C7(nbCat=10)))
model2.nodes_id=0,2,3,5,6,7,8,9,10,11,12,16,17
nonhomogeneous.root_freq=Fixed()
rate_distribution=Constant()
|};
......@@ -3,7 +3,6 @@ open Bistro_utils
open Bistro.EDSL
open Bistro.Std
open File_formats
open Models_def
let ready_dataset_of_raw_dataset raw_dataset =
let input_tree = raw_dataset.input_tree in
......@@ -34,7 +33,7 @@ let repo_of_raw_dataset (raw_dataset:raw_dataset) =
let derive_from_model ~model ~tree ~tree_dataset ~preview =
let nb_sites = if preview then 10 else 100 in
let config = define_bpp_config_of_model model in
let config = Convergence_hypothesis.bpp_config model in
let tree = Tree_dataset.tree tree_dataset `Simulation in
let fna = Bppsuite.bppseqgen ~nb_sites ~tree ~config in
let faa = Bppsuite.fna2faa ~fna in
......@@ -49,10 +48,10 @@ let derive_from_model ~model ~tree ~tree_dataset ~preview =
let derive_from_tree ~tree_dir ~tree ~preview =
let tree = input (Filename.concat tree_dir tree) in
let tree_dataset = Tree_dataset.prepare tree in
let models = [H0; Ha] in
let models = Convergence_hypothesis.[H0; Ha] in
List.map models ~f:(fun model ->
derive_from_model ~model ~tree ~tree_dataset ~preview
|> Repo.shift (string_of_model model)
|> Repo.shift (Convergence_hypothesis.string_of_model model)
)
|> List.concat
......
open Core
open Bistro_utils
open Bistro.EDSL
open Bistro.Std
open File_formats
open Models_def
let parse_input_tree ~tree : parsed_input_tree directory workflow =
workflow ~descr:"utils.parse_input_tree" [
(*let env = docker_image ~account:"carinerey" ~name:"ete3:3.0.0b35" () in*)
cmd "python" (*~env*) [
file_dump (string Scripts.parse_input_tree) ;
opt "-t" dep tree ;
opt "-o" ident dest ;
]
]
......@@ -2,7 +2,6 @@ open Core
open Bistro.EDSL
open Bistro.Std
open File_formats
open Models_def
let env = docker_image ~account:"carinerey" ~name:"ete3:3.0.0b35" ()
......@@ -15,10 +14,10 @@ let prepare tree =
]
]
let nodes dataset model =
let nodes dataset (model : Convergence_hypothesis.t) =
dataset / selector (
match model with
| Models_def.H0 -> [ "tree.H0.node_ids" ]
| H0 -> [ "tree.H0.node_ids" ]
| Ha -> [ "tree.Ha.node_ids" ]
)
......
......@@ -4,7 +4,7 @@ open File_formats
val prepare : nhx workflow -> [`tree_dataset] directory workflow
val nodes :
[`tree_dataset] directory workflow ->
Models_def.model ->
Convergence_hypothesis.t ->
text_file workflow
val tree :
......
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