convergence_hypothesis.ml 4.74 KB
Newer Older
1 2 3 4 5
open Core
open Bistro.EDSL
open Bistro.Std

type t =
Carine Rey's avatar
Carine Rey committed
6 7 8 9 10
  | H0_NeG1
  | H0_NeG2
  | H0_NeG3
  | H0_NeG4
  | H0_NeG5
11 12
  | H0_NeG5_NeC_div2
  | H0_NeG5_NeC_x2
Carine Rey's avatar
Carine Rey committed
13 14 15 16 17
  | HaPC_NeG1
  | HaPC_NeG2
  | HaPC_NeG3
  | HaPC_NeG4
  | HaPC_NeG5
Carine Rey's avatar
Carine Rey committed
18
  | HaPCOC
19 20
  | HaPC_NeG5_NeC_div2
  | HaPC_NeG5_NeC_x2
Carine Rey's avatar
Carine Rey committed
21 22 23 24
  | HaPC_NeG1_NeC_5
  | HaPC_NeG5_NeC_1
  | H0_NeG1_NeC_5  
  | H0_NeG5_NeC_1  
25 26

let string_of_model m = match m with
27 28 29 30 31
  | H0_NeG1            -> "H0_NeG1"
  | H0_NeG2            -> "H0_NeG2"
  | H0_NeG3            -> "H0_NeG3"
  | H0_NeG4            -> "H0_NeG4"
  | H0_NeG5            -> "H0_NeG5"
Carine Rey's avatar
Carine Rey committed
32 33 34 35 36
  | HaPC_NeG1          -> "HaPC_NeG1"
  | HaPC_NeG2          -> "HaPC_NeG2"
  | HaPC_NeG3          -> "HaPC_NeG3"
  | HaPC_NeG4          -> "HaPC_NeG4"
  | HaPC_NeG5          -> "HaPC_NeG5"
37 38 39 40 41
  | HaPCOC             -> "HaPCOC"
  | HaPC_NeG5_NeC_div2 -> "HaPC_NeG5_NeC_div2"
  | HaPC_NeG5_NeC_x2   -> "HaPC_NeG5_NeC_x2"
  | H0_NeG5_NeC_div2   -> "H0_NeG5_NeC_div2"
  | H0_NeG5_NeC_x2     -> "H0_NeG5_NeC_x2"
Carine Rey's avatar
Carine Rey committed
42 43 44 45
  | HaPC_NeG1_NeC_5    -> "HaPC_NeG1_NeC_5"
  | HaPC_NeG5_NeC_1   -> "HaPC_NeG5_NeC_1"
  | H0_NeG1_NeC_5     -> "H0_NeG1_NeC_5"
  | H0_NeG5_NeC_1     -> "H0_NeG5_NeC_1"
46

47 48 49
let assign k v =
  seq ~sep:"=" [ string k ; v ]

50
let bpp_config_base = {|
51 52 53 54 55 56
alphabet=Codon(letter=DNA)
genetic_code = Standard
input.tree.format=Nhx
output.internal.sequences=no
nonhomogeneous = general
rate_distribution=Constant()
57 58
|}

Carine Rey's avatar
Carine Rey committed
59
let bpp_config_H0_F= seq ~sep:"\n" [
60 61 62
    seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)))" ] ;
    seq [string "nonhomogeneous.root_freq=FromModel(model=$(model1))" ] ;
  ]
63

Carine Rey's avatar
Carine Rey committed
64
let bpp_config_HaPCOC_F = seq ~sep:"\n" [
65 66 67 68 69
    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=$(model1))" ] ;
  ]
Carine Rey's avatar
Carine Rey committed
70
let bpp_config_HaPC_F = seq ~sep:"\n" [
71 72 73 74 75
    seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)))" ] ;
    seq [string "modelT=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)))" ] ;
    seq [string "modelC=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)))" ] ;
    seq [string "nonhomogeneous.root_freq=FromModel(model=$(model1))" ] ;
  ]
76 77

let bpp_config_H0_F_Ne = seq ~sep:"\n" [
78 79 80 81
    seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)), Ns=$(NE_1))" ] ;
    seq [string "model2=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)), Ns=$(NE_C))" ] ;
    seq [string "nonhomogeneous.root_freq=FromModel(model=$(model1))" ] ;
  ]
82

Carine Rey's avatar
Carine Rey committed
83
let bpp_config_HaPCOC_F_Ne = seq ~sep:"\n" [
84 85 86 87 88
    seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)), Ns=$(NE_1))" ] ;
    seq [string "modelT=OneChange(model=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2))), register=DnDs, numReg=2, Ns=$(NE_T))" ] ;
    seq [string "modelC=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)), Ns=$(NE_C))" ] ;
    seq [string "nonhomogeneous.root_freq=FromModel(model=$(model1))" ] ;
  ]
89

Carine Rey's avatar
Carine Rey committed
90
let bpp_config_HaPC_F_Ne = seq ~sep:"\n" [
91
    seq [string "model1=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M1)), Ns=$(NE_1))" ] ;
Carine Rey's avatar
Carine Rey committed
92
    seq [string "modelT=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)), Ns=$(NE_T))" ] ;
93 94 95
    seq [string "modelC=Codon_AAFit(model=K80, fitness=Empirical(file=$(PROFILE_F), col=$(COL_M2)), Ns=$(NE_C))" ] ;
    seq [string "nonhomogeneous.root_freq=FromModel(model=$(model1))" ] ;
  ]
Carine Rey's avatar
Carine Rey committed
96

Carine Rey's avatar
Carine Rey committed
97
let bpp_config_F nodes hyp = [
98 99
  string bpp_config_base ;
  insert nodes ;
100
  match hyp with
Carine Rey's avatar
Carine Rey committed
101 102 103 104 105 106 107 108 109 110
  | H0_NeG1             -> bpp_config_H0_F_Ne
  | H0_NeG2             -> bpp_config_H0_F_Ne
  | H0_NeG3             -> bpp_config_H0_F_Ne
  | H0_NeG4             -> bpp_config_H0_F_Ne
  | H0_NeG5             -> bpp_config_H0_F_Ne
  | HaPC_NeG1           -> bpp_config_HaPC_F_Ne
  | HaPC_NeG2           -> bpp_config_HaPC_F_Ne
  | HaPC_NeG3           -> bpp_config_HaPC_F_Ne
  | HaPC_NeG4           -> bpp_config_HaPC_F_Ne
  | HaPC_NeG5           -> bpp_config_HaPC_F_Ne
111
  | HaPCOC              -> bpp_config_HaPCOC_F
112 113 114 115
  | HaPC_NeG5_NeC_div2  -> bpp_config_HaPC_F_Ne
  | HaPC_NeG5_NeC_x2    -> bpp_config_HaPC_F_Ne
  | H0_NeG5_NeC_div2    -> bpp_config_H0_F_Ne
  | H0_NeG5_NeC_x2      -> bpp_config_H0_F_Ne
Carine Rey's avatar
Carine Rey committed
116 117 118 119
  | HaPC_NeG1_NeC_5     -> bpp_config_HaPC_F_Ne
  | HaPC_NeG5_NeC_1     -> bpp_config_HaPC_F_Ne
  | H0_NeG1_NeC_5       -> bpp_config_H0_F_Ne
  | H0_NeG5_NeC_1       -> bpp_config_H0_F_Ne
120
    ;
121
]