Commit f54038b7 authored by Philippe Veber's avatar Philippe Veber
Browse files

tk/Mutsel_simulator_cpg: fixed out of bound error for sequences of size 1

parent 04acf267
...@@ -39,14 +39,15 @@ module Evolution_model = struct ...@@ -39,14 +39,15 @@ module Evolution_model = struct
|> fitness_of_profile |> fitness_of_profile
let make_param ~gBGC ~scaled_fitness ~omega ~nucleotide_rates ~nucleotide_stat_dist ~rate_CpG state pos _branch = let make_param ~gBGC ~scaled_fitness ~omega ~nucleotide_rates ~nucleotide_stat_dist ~rate_CpG state pos _branch =
let context_CpG = let n = Array.length state in
if pos = 0 then let left_codon =
context_CpG_of_codons ~right_codon:state.(pos+1) () if 0 <= pos - 1 && pos - 1 < n
else if pos = (Array.length state - 1 ) then then Some state.(pos - 1)
context_CpG_of_codons ~left_codon:state.(pos-1) () else None
else and right_codon =
context_CpG_of_codons ~left_codon:state.(pos -1) ~right_codon:state.(pos + 1) () if pos + 1 < n then Some state.(pos + 1) else None
in in
let context_CpG = context_CpG_of_codons ?left_codon ?right_codon () in
{ {
nucleotide_rates; nucleotide_rates;
nucleotide_stat_dist; nucleotide_stat_dist;
......
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