forked from stevemussmann/BayesAss3-SNPs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BA3.h
71 lines (66 loc) · 2.54 KB
/
BA3.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
/*
* BA3.h
* BA3
*
* Created by Bruce Rannala on 11/29/10.
* Copyright 2010 University of California Davis. All rights reserved.
*
*/
#ifndef BA3_HEADERS
#define BA3_HEADERS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <map>
#include <math.h>
#include <gsl/gsl_sf_gamma.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_permutation.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <cmath>
#include "indiv.h"
using namespace std;
//const int MAXLOCI=10000;
const int MAXALLELE=300;
const int MAXPOPLN=100;
const int MAXINDIV=5000;
const int MAXLINELENGTH=1000000;
/*
struct indiv
{
int genotype[MAXLOCI][2];
vector<int> missingGenotypes;
unsigned int samplePopln;
unsigned int migrantPopln;
unsigned int migrantAge;
double logL;
};
*/
struct ancestryProbs
{
double poplnPostProb[MAXPOPLN][3];
};
void printBanner(void);
void readInputFile(Indiv **sampleIndiv, unsigned int &noIndiv, unsigned int &noLoci, unsigned int &noPopln, unsigned int *noAlleles, string &infileName, int MAXLOCI);
void getEmpiricalAlleleFreqs(double ***alleleFreqs, Indiv **sampleIndiv, unsigned int *noAlleles, unsigned int noPopln, unsigned int noLoci, unsigned int noIndiv, bool debug);
void fillMigrantCounts(Indiv **sampleIndiv, long int ***migrantCounts, unsigned int noIndiv, unsigned int noPopln);
double migCountLogProb(long int ***migrantCounts, double **migrationRates, unsigned int noPopln);
double logLik(Indiv *Indiv, double ***alleleFreqs, double *FStat, unsigned int noLoci);
double oneLocusLogLik(Indiv *Indiv, double ***alleleFreqs, double *FStat, int chosenLocus);
// void proposeMigrantAncDrop(int &migrantPopln, int &migrantAge, int samplePopln, int noPopln, long int ***migrantCounts);
void proposeMigrantAncDrop(unsigned int &migrantPopln, unsigned int &migrantAge, unsigned int samplePopln, int noPopln, long int ***migrantCounts);
void proposeMigrantAncAdd(unsigned int &migrantPopAdd, unsigned int &migrantAgeAdd,unsigned int migrantPopDrop, unsigned int migrantAgeDrop,
unsigned int samplePopln, int noPopln);
void parseComLine(int argc, char **argv, string &infileName, int &seed, unsigned int &mciter, unsigned int &sampling, unsigned int &burnin, string &outfileName,
double &deltaM, double &deltaA, double &deltaF, bool &verbose, bool& settings,
bool &genotypes, bool &trace, bool &debug, bool &nolikelihood, int &MAXLOCI);
std::string remove_extension(const std::string& filename);
#endif