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