mapgd  0.4
A program for the Maximum-likelihood analysis of population genomic data.
 All Data Structures Functions Variables Friends Groups Pages
relatedness.h
1 #ifndef _RELATEDNESS_H_
2 #define _RELATEDNESS_H_
3 
4 #include <stdio.h>
5 #include <cmath>
6 #include <math.h>
7 #include <stdlib.h>
8 #include <iostream>
9 #include <iomanip>
10 
11 #include "interface.h"
12 #include "map_file.h"
13 #include "genotype.h"
14 #include "genotype_pair.h"
15 #include "relatedness_data.h"
16 #include "newton-method-rel.h"
17 #include "constants.h"
18 
19 #ifndef NOOMP
20 #include <omp.h>
21 #endif
22 
23 #ifndef NOGSL
24 #include <gsl/gsl_multimin.h>
25 #include <gsl/gsl_permutation.h>
26 #include <gsl/gsl_vector.h>
27 #include <gsl/gsl_matrix.h>
28 #include <gsl/gsl_linalg.h>
29 #include <gsl/gsl_blas.h>
30 #endif
31 
34 int estimateRel(int argc, char *argv[]);
38 size_t
39 freqtoi(float_t in);
40 
41 //DONE Moved to in memory
42 std::map <Genotype_pair_tuple, size_t>
43 hash_genotypes (const std::stringstream &, const size_t &, const size_t &, const bool &);
44 
45 //DONE Moved to in memory
46 std::map <Genotype_pair_tuple, size_t>
47 downsample_genotypes (const std::stringstream &, const size_t &, const size_t &, const bool &);
48 
49 /*Does a regression of allele frequency of the samples on the population allele frequency*/
50 void
51 set_e(Relatedness &relatedness, std::map <Genotype_pair_tuple, size_t> &hashed_genotypes);
52 
53 /*Guess starting values of relatedness for the maximization procedure*/
54 void
55 gestimate(Relatedness &relatedness, std::map <Genotype_pair_tuple, size_t> &counts);
56 
57 void
58 inc_f(Relatedness &rel, const Genotype_pair &pair, const size_t &count);
59 
60 void
61 inc_theta(Relatedness &rel, const Genotype_pair &pair, const size_t &count);
62 
63 void
64 inc_gamma(Relatedness &rel, const Genotype_pair &pair, const size_t &count);
65 
66 void
67 inc_Delta (Relatedness &rel, const Genotype_pair &pair, const size_t &count);
68 
69 //TODO FIX THIS TERRIBLE HACK JOB YOU SCHMUCK!
70 
71 float_t
72 get_ll (const Relatedness &rel, const Genotype_pair &pair, const float_t count);
73 
74 #ifndef NOGSL
75 double
76 rel_ll (const gsl_vector *v, void *void_hashed_genotypes_p);
77 #endif
78 
79 /*Maximizes the relatedness*/
80 void
81 maximize(Relatedness &rel, std::map <Genotype_pair_tuple, size_t> &hashed_genotypes);
82 
83 void
84 get_llr(Relatedness &rel, std::map <Genotype_pair_tuple, size_t> hashed_genotypes);
85 
86 #endif
87 
Relatedness data.
Definition: relatedness_data.h:18
Definition: genotype_pair.h:19