Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 3040a425 authored by Carine Rey's avatar Carine Rey
Browse files

refactoring

parent dce707d1
......@@ -11,25 +11,26 @@ let assign k v =
seq ~sep:"=" [ string k ; v ]
let conf_file_bppseqgen ~tree ~out ~nb_sites ~config =
let conf_file_bppseqgen ~tree ~out ~nb_sites ~config ~profile_f =
seq ~sep:"\n" (
[
assign "input.tree.file" (dep tree) ;
assign "output.sequence.file" out ;
assign "number_of_sites" (int nb_sites) ;
assign "PROFILE_F" (dep profile_f);
]
@ config
)
let bppseqgen ?(descr="") ?profile_f ~nb_sites ~tree ~config : nucleotide_fasta workflow =
let bppseqgen ?(descr="") ~profile_f ~nb_sites ~tree ~config : nucleotide_fasta workflow =
let config_f = dest // "config.bpp" in
let out = dest // "seq.fa" in
workflow ~descr:("bppsuite.bppseqgen" ^ descr) [
docker env (
and_list [
mkdir_p dest;
cmd "cat" ~stdout:config_f [(file_dump (conf_file_bppseqgen ~tree ~out ~nb_sites ~config))];
cmd "bppseqgen" ~env [
cmd "cat" ~stdout:config_f [(file_dump (conf_file_bppseqgen ~tree ~out ~nb_sites ~config ~profile_f))];
cmd "bppseqgen" [
assign "param" config_f;
]
]
......
......@@ -4,7 +4,7 @@ open File_formats
val bppseqgen :
?descr : string ->
?profile_f: _ workflow ->
profile_f: _ workflow ->
nb_sites:int ->
tree:nhx workflow ->
config:Bistro.Template.t list ->
......
......@@ -19,7 +19,6 @@ genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
nonhomogeneous.root_freq=Fixed()
rate_distribution=Constant()
|}
......@@ -42,29 +41,28 @@ let bpp_config nodes hyp = [
) ;
]
let bpp_config_H0_F ~profile_f = seq ~sep:"\n" [
assign "COL_M1" (int 2) ;
let bpp_config_H0_F= seq ~sep:"\n" [
(* string {|nonhomogeneous.number_of_models = 1 |} ; Mv in insert nodes*)
seq [string "model1=Codon_AAFit(model=K80, fitness=FromModel(model=JTT92+F(frequencies=Empirical(file=" ; dep profile_f ; string ", col=$(COL_M1)))))" ] ;
assign "COL_M1" (int 100) ;
seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)))" ] ;
seq [string "nonhomogeneous.root_freq=FromModel(model=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1))))" ] ;
]
let bpp_config_Ha_F ~profile_f = seq ~sep:"\n" [
let bpp_config_Ha_F = seq ~sep:"\n" [
(* string {|nonhomogeneous.number_of_models = 3 or 2 |} ; Mv in insert nodes*)
assign "COL_M1" (int 2) ;
assign "COL_M2" (int 85) ;
assign "modelT" (string "model2") ;
assign "modelC" (string "model3") ;
seq [string "model1=Codon_AAFit(model=K80, fitness=FromModel(model=JTT92+F(frequencies=Empirical(file=" ; dep profile_f ; string ", col=$(COL_M1)))))" ] ;
seq [string "$(modelT)=OneChange(model=Codon_AAFit(model=K80, fitness=FromModel(model=JTT92+F(frequencies=Empirical(file=" ; dep profile_f ; string ", col=$(COL_M2))))))" ] ;
seq [string "$(modelC)=Codon_AAFit(model=K80, fitness=FromModel(model=JTT92+F(frequencies=Empirical(file=" ; dep profile_f ; string ", col=$(COL_M2)))))" ] ;
assign "COL_M1" (int 100) ;
assign "COL_M2" (int 98) ;
seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)))" ] ;
seq [string "modelT=OneChange(model=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2))), register=DnDs, numReg=2)" ] ;
seq [string "modelC=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)))" ] ;
seq [string "nonhomogeneous.root_freq=FromModel(model=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1))))" ] ;
]
let bpp_config_F nodes hyp profile_f = [
let bpp_config_F nodes hyp = [
string bpp_config_base ;
insert nodes ;
match hyp with
| H0 -> bpp_config_H0_F ~profile_f
| Ha -> bpp_config_Ha_F ~profile_f
| H0 -> bpp_config_H0_F
| Ha -> bpp_config_Ha_F
;
]
......@@ -55,9 +55,9 @@ let repo_of_dataset_l ~preview dataset_l =
let derive_from_model ~model ~tree ~tree_dataset ~tree_prefix ~profile_f ~preview =
let model_prefix = Convergence_hypothesis.string_of_model model in
let nb_sites = if preview then 10 else 100 in
let nb_sites = if preview then 20 else 1000 in
let nodes = Tree_dataset.nodes tree_dataset model in
let config = Convergence_hypothesis.bpp_config_F nodes model profile_f in
let config = Convergence_hypothesis.bpp_config_F nodes model in
let tree = Tree_dataset.tree tree_dataset `Simulation in
let descr = "."^model_prefix^"."^tree_prefix in
let fna = Bppsuite.bppseqgen ~descr ~nb_sites ~tree ~config ~profile_f in
......
......@@ -164,23 +164,21 @@ logger.info(not_conv_node_ids)
if trans_node_ids and conv_node_ids:
nonhomogeneous_number_of_models = "nonhomogeneous.number_of_models = 3"
models = "\n".join(["modelT = model2",
"modelC = model3"])
models = "\n".join(["model2 = $(modelT)",
"model3 = $(modelC)"])
node_ids = "\n".join(["model1.nodes_id="+",".join(map(str, not_conv_node_ids)),
"model2.nodes_id="+",".join(map(str, trans_node_ids)),
"model3.nodes_id="+",".join(map(str, conv_node_ids))
])
elif trans_node_ids and not conv_node_ids:
nonhomogeneous_number_of_models = "nonhomogeneous.number_of_models = 2"
models = "\n".join(["modelT = model2",
"modelC = model3"])
models = "\n".join(["model2 = $(modelT)"])
node_ids = "\n".join(["model1.nodes_id="+",".join(map(str, not_conv_node_ids)),
"model2.nodes_id="+",".join(map(str, trans_node_ids))
])
elif not trans_node_ids and conv_node_ids:
nonhomogeneous_number_of_models = "nonhomogeneous.number_of_models = 2"
models = "\n".join(["modelT = model3",
"modelC = model2"])
models = "\n".join(["model2 = $(modelC)"])
node_ids = "\n".join(["model1.nodes_id="+",".join(map(str, not_conv_node_ids)),
"model2.nodes_id="+",".join(map(str, conv_node_ids))
])
......@@ -205,7 +203,7 @@ t.write(format=1, features=["Condition","Transition"], outfile = "%s/tree.only_c
### tree.diffsel: a diffsel input formated tree
for n in t.traverse():
if n.ND in conv_node_ids:
if n.ND in conv_node_ids+trans_node_ids:
n.dist = 2
elif n.ND in not_conv_node_ids:
n.dist = 1
......
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