Commit 487f8876 authored by Philippe Veber's avatar Philippe Veber
Browse files

update wrt phylogenetics, tdg09 sims are now deterministic

parent 8f09c49e
...@@ -79,9 +79,9 @@ module Evolution_model = struct ...@@ -79,9 +79,9 @@ module Evolution_model = struct
test_diagonal_matrix_exponential () test_diagonal_matrix_exponential ()
end end
let choose_aa p = let choose_aa p ~rng =
Amino_acid.Table.of_vector p Amino_acid.Table.of_vector p
|> Amino_acid.Table.choose |> Amino_acid.Table.choose ~rng
module CTMC = Phylo_ctmc module CTMC = Phylo_ctmc
...@@ -244,7 +244,7 @@ module Make(Branch_info : Branch_info)(Leaf_info : Leaf_info)(Site : Site with t ...@@ -244,7 +244,7 @@ module Make(Branch_info : Branch_info)(Leaf_info : Leaf_info)(Site : Site with t
ll, decode_vec vec ll, decode_vec vec
let simulate_site ~rng ~exchangeability_matrix ~stationary_distribution tree ~param:scale = let simulate_site ~rng ~exchangeability_matrix ~stationary_distribution tree ~param:scale =
let root = choose_aa stationary_distribution in let root = choose_aa stationary_distribution ~rng in
let p = { let p = {
Evolution_model.stationary_distribution ; scale ; Evolution_model.stationary_distribution ; scale ;
exchangeability_matrix ; exchangeability_matrix ;
...@@ -482,7 +482,7 @@ module Make(Branch_info : Branch_info)(Leaf_info : Leaf_info)(Site : Site with t ...@@ -482,7 +482,7 @@ module Make(Branch_info : Branch_info)(Leaf_info : Leaf_info)(Site : Site with t
{ scale ; stationary_distribution0 ; stationary_distribution1 } { scale ; stationary_distribution0 ; stationary_distribution1 }
(Branch_info.condition b) (Branch_info.condition b)
in in
let root = choose_aa stationary_distribution0 in let root = choose_aa stationary_distribution0 ~rng in
Simulator.site_gillespie_first_reaction rng tree ~root ~param Simulator.site_gillespie_first_reaction rng tree ~root ~param
end end
end end
...@@ -534,7 +534,7 @@ module Implementation_check = struct ...@@ -534,7 +534,7 @@ module Implementation_check = struct
let likelihood_plot_demo (wag : Wag.t) = let likelihood_plot_demo (wag : Wag.t) =
let rng = Gsl.Rng.(make (default ())) in let rng = Gsl.Rng.(make (default ())) in
let tree = pair_tree ~branch_length1:1. ~branch_length2:1. ~npairs:100 in let tree = pair_tree ~branch_length1:1. ~branch_length2:1. ~npairs:100 in
let root = choose_aa wag.freqs in let root = choose_aa wag.freqs ~rng in
let true_scale = 1. in let true_scale = 1. in
let p = Evolution_model.param_of_wag wag true_scale in let p = Evolution_model.param_of_wag wag true_scale in
let site = let site =
......
...@@ -36,7 +36,7 @@ let stationary_counts_vs_props (wag : Wag.t) ~scale ~nb_leaves ~bl = ...@@ -36,7 +36,7 @@ let stationary_counts_vs_props (wag : Wag.t) ~scale ~nb_leaves ~bl =
let root = let root =
wag.freqs wag.freqs
|> Amino_acid.Table.of_vector |> Amino_acid.Table.of_vector
|> Amino_acid.Table.choose |> Amino_acid.Table.choose ~rng
in in
let p = Tdg09.Evolution_model.param_of_wag wag scale in let p = Tdg09.Evolution_model.param_of_wag wag scale in
let site = Simulator.site_gillespie_direct rng tree ~root ~param:(Fn.const p) in let site = Simulator.site_gillespie_direct rng tree ~root ~param:(Fn.const p) in
......
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