Commit 6d715ccb authored by Philippe Veber's avatar Philippe Veber
Browse files

whitespacecommit

parent d33cb5a3
......@@ -21,11 +21,11 @@ module Mutsel_cpg = struct
context_CpG : context_CpG;
}
let inspect_codon codon =
let x, y, z = NSCodon.nucleotides codon in
let inspect_codon codon =
let x, y, z = NSCodon.nucleotides codon in
Nucleotide.(inspect x, inspect y, inspect z)
let context_CpG_of_codons p ?lh ?rh () =
let context_CpG_of_codons p ?lh ?rh () =
let open Option.Monad_infix in
{
lh = lh >>| (fun lh -> inspect_codon lh |> trd3);
......@@ -33,16 +33,16 @@ module Mutsel_cpg = struct
codon = inspect_codon p;
}
let make_param state pos _branch =
let make_param state pos _branch =
let fitness_of_profile ?(beta = 1.) =
Amino_acid.Vector.map ~f:(fun x -> beta *. Float.log x)
Amino_acid.Vector.map ~f:(fun x -> beta *. Float.log x)
in
let flat_fitness () =
Amino_acid.Vector.init (fun _ -> 1. /. float Amino_acid.card)
|> fitness_of_profile
in
let context_CpG =
if pos = 0
let context_CpG =
if pos = 0
then context_CpG_of_codons state.(pos) ~rh:state.(pos+1) ()
else if pos = (Array.length state - 1 )
then context_CpG_of_codons state.(pos) ~lh:state.(pos-1) ()
......@@ -64,11 +64,11 @@ module Mutsel_cpg = struct
let rate_increase_CpG (pos, x_a, x_b) context =
match Nucleotide.(pos, inspect x_a, inspect x_b), context with
| (0, C, T), { codon=(_,G, _) ; _ }
| (1, C, T), { codon=(_,_, G) ; _ }
| (2, C, T), { rh=Some G ; _ }
| (1, C, T), { codon=(_,_, G) ; _ }
| (2, C, T), { rh=Some G ; _ }
| (0, G, A), { lh=Some C ; _ }
| (1, G, A), { codon=(C, _, _) ; _ }
| (2, G, A), { codon=(_,C,_) ; _ } -> true
| (1, G, A), { codon=(C, _, _) ; _ }
| (2, G, A), { codon=(_,C,_) ; _ } -> true
| _ -> false
let fixation_probability delta =
......@@ -116,8 +116,8 @@ module Mutsel_cpg = struct
*. exp (p.scaled_fitness.Amino_acid.%(aa) +. (b n1 +. b n2 +. b n3) /. 2.)
)
|> NSCodon.Vector.normalize
end
end
module M(BI: Simulator.Branch_info) = struct
module M(BI: Simulator.Branch_info) = struct
include Simulator.Make(Mutsel_cpg.NSCodon)(Mutsel_cpg)(BI)
end
\ No newline at end of file
end
......@@ -4,7 +4,7 @@ open Phylogenetics
module Mutsel_cpg : sig
module NSCodon = Codon.Universal_genetic_code.NS
type context_CpG = {
lh: Nucleotide.repr option;
rh: Nucleotide.repr option;
......@@ -31,4 +31,4 @@ end
module M(BI: Simulator.Branch_info) : sig
include module type of Simulator.Make(Mutsel_cpg.NSCodon)(Mutsel_cpg)(BI)
end
\ No newline at end of file
end
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