forked from statgen/glfFlex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlfLikelihoods.h
executable file
·87 lines (65 loc) · 1.8 KB
/
GlfLikelihoods.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef __GLFLIKELIHOODS_H__
#define __GLFLIKELIHOODS_H__
#include "glfHandler.h"
#include "MathGold.h"
#include "Pedigree.h"
#include <math.h>
// Chromosome types
#define CT_AUTOSOME 0
#define CT_CHRX 1
#define CT_CHRY 2
#define CT_MITO 3
class GenotypeLikelihood : public ScalarMinimizer
{
public:
int n;
glfHandler * glf;
char * sexes;
int chromosomeType;
int position;
GenotypeLikelihood(int count, glfHandler * glfPointers);
virtual ~GenotypeLikelihood();
void SetAlleles(int al1, int al2);
virtual double f(double freq) { return -Evaluate(freq); }
virtual double Evaluate(double freq);
void GetPriors(double * priors, double freq, int i);
void GetMalePriors(double * priors, double freq);
void GetFemalePriors(double * priors, double freq);
double OptimizeFrequency();
protected:
int allele1, allele2;
int geno11, geno12, geno22;
};
class FilterLikelihood : public GenotypeLikelihood
{
public:
FilterLikelihood(int count, glfHandler * glfPointers);
void SetReferenceAllele(int ref);
virtual double Evaluate(double freq);
protected:
int reference;
int group[10];
};
class FullLikelihood : public GenotypeLikelihood {
public:
FullLikelihood(int count, glfHandler * glfPointers);
virtual ~FullLikelihood();
void SetAlleles(int _ref, int* _alts);
double OptimizeFrequency(int priorAN = 0, int* priorACs = NULL);
double inbreedingCoeff();
double hwdLRT();
double* dGPs;
double* GPs;
double* APs;
double* sumPs;
double* dsumPs;
int ref;
int alts[3];
double freqs[5];
double dfreqs[10];
int* bestGenotypes;
int* qualGenotypes;
unsigned char* ploidies;
double hwdLLK;
};
#endif