-
Notifications
You must be signed in to change notification settings - Fork 0
/
utility.h
executable file
·69 lines (50 loc) · 2.37 KB
/
utility.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
#ifndef __UTILITY_H__
#define __UTILITY_H__
#include <cmath>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <algorithm>
#include <string>
#include <vector>
#include <random>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <RInside.h>
#include "stats.h"
using namespace std;
extern ofstream LOG;
extern RInside RTmp;
///////////////////////////////////////////
// Type definitions
///////////////////////////////////////////
// Define matrix_t as 2-D vector
typedef vector<vector<double> > matrix_t;
// Type definitions from BOOST
typedef long long int64;
typedef unsigned char BYTE;
typedef unsigned long long uint64;
#define FMT_INT64 "%lld"
#define FMT_UINT64 "%llu"
#define FMT_HEX64 "%llx"
#define pp_maxsnp 6
///////////////////////////////////////////
// Function definitions
///////////////////////////////////////////
void printLOG(string s);
string int2str(int n);
string char2str(char *f);
void GetFileNames(string cfname, string &foutpath, string &resname, string &logname, string &filename, string &mapname, string &setpath, string &setname, int &numSets, bool show_message);
void GetSnpInfo(string filename, vector<int> &snpchr, vector<string> &snpname, bool show_message);
void GetSetInfo(string setname, vector<string> &snpname, vector<int> &sA, vector<int> &sB, bool &skip_symm, bool set_test, int p, bool show_message);
void GetDataSize(string filename, int **DataSize, int &ndataset_out, bool show_message);
void GetData(string filename, int *DataSize, int &n, int &p, int &ncase, int &nctrl, int ndataset, vector<bool> &pheno, BYTE ***geno, double ***geno_bar, bool show_message);
double CalcRegionInter(string fout, vector<bool> &pheno, BYTE **geno, double **geno_bar, vector<int> &snpchr, vector<string> &snpname, bool skip_symm, int p, int n, int ncase, int nctrl, vector<int> &sA, vector<int> &sB, double myth_pgates, double myth_trun, int reps, bool flagperm, int max_cov_cnt, bool show_message);
void LDContrastTest(vector<bool> &pheno, vector<double> &zlist, vector<double> &plist, vector<int> &cov_index, BYTE **geno, double **geno_bar, vector<int> &sA, vector<int> &sB, bool skip_symm, int p, int n, int ncase, int nctrl, bool show_message);
bool isFileExist(const char *fileName);
#endif