Debian Codegraph @

tests/PartialSelfing/firstallele.pure_herm.multi_theta.BP.hs

raw symbols SCIP
1 module Test where
2 {
3 import PopGen;
4 import Probability;
5 get_AFS file = map (allele_frequency_spectrum . remove_2nd_allele) $ vectorToList $ read_phase_file file;
6
7 filename = "/home/bredelings/Reports/Kmar/BP.phase1.infile";
8
9 n = 5;
10
11 note mean ~ iid(n, gamma(0.5,0.5) );
12 note sigmaOverMu ~ iid(n, gamma(1.05,0.1) );
13
14 alpha = 1.0;
15
16 note p ~ symmetric_dirichlet (n, alpha/(intToDouble n));
17
18 data1 = get_AFS filename;
19
20 n_loci = length data1;
21
22 note category ~ iid(n_loci, categorical p);
23
24 note z ~ iid(n_loci, normal(0.0, 1.0));
25
26 safe_exp x = if (x < (-20.0)) then
27 exp (-20.0);
28 else if (x > 20.0) then
29 exp 20.0;
30 else
31 exp x;
32
33 theta = [ mean!!k * safe_exp (z!!i * sigmaOverMu!!k) | i <- take n_loci [0..], let {k=category!!i}];
34
35 theta_effective = map (*(2.0-s)) theta;
36
37 note theta_example ~ mixture [ (p!!i, logNormal(log(mean!!i),sigmaOverMu!!i)) | i <- take n [0..] ];
38
39 note data data1 ~ plate (n_loci, \l -> afs (theta_effective!!l));
40 note MakeLogger p;
41 note MakeLogger theta;
42 }