-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoreassoc.hpp
69 lines (55 loc) · 3.71 KB
/
scoreassoc.hpp
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 SCOREASSOCHPP
#define SCOREASSOCHPP
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
extern "C" {
#include "sagcutils.h"
};
#define MAX_COMMENT_LENGTH 100
#define NAME_LENGTH 20
enum OPT {
PSDATAFILE=0,GCDATAFILE,GENDATAFILE,WEIGHTFILE,ANNOTFILE,FILTERFILE,LOCUSFILTERFILE,LOCUSNAMEFILE,LOCUSWEIGHTFILE,TRIOFILE,SAMPLEFILE,CASEFREQFILE,CONTFREQFILE,OUTFILE,SCOREFILE,NUMDATAFILETYPES,NUMLOCI,LDTHRESHOLD,WEIGHTTHRESHOLD,DORECESSIVE,USEHAPS,WEIGHTFACTOR,ARGFILE,NUMOPTS
};
struct option_t {
char *str;
OPT o;
};
typedef struct option_t option;
extern option opt[];
class sa_data_file_type {
public:
FILE *fp;
char fn[200];
sa_data_file_type() { fp = 0; fn[0] = '\0'; }
~sa_data_file_type() { if (fp != 0 && fp != stdout) fclose(fp); }
};
struct sa_par_info_t {
sa_data_file_type df[NUMDATAFILETYPES];
float wfactor,LD_threshold,weight_threshold;
int use_func_weights,use_cc_freqs[2],use_locus_names,use_comments,do_recessive_test,use_haplotypes,use_trios,use_probs;
};
typedef struct sa_par_info_t sa_par_info;
enum { DE_NOVO=0, NON_MENDELIAN };
struct non_mendelian_t {
int loc,sub,nd;
};
typedef struct non_mendelian_t non_mendelian;
double do_score_onetailed_ttest(FILE *fo,float *score,subject **sub,int nsub,par_info *pi,sa_par_info *spi,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],int max_cc[2],float *weight,float *missing,int *rarer);
void get_scores(float *score,float *weight,float *missing_score,int *rarer,subject **sub,int nsub,par_info *pi,sa_par_info *spi);
void set_weights(FILE *fo,float *weight,float *missing_score,int *rarer,subject **sub,int nsub,par_info *pi,sa_par_info *spi,float *func_weight,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],int max_cc[2],char names[MAX_LOCI][20],char comments[MAX_LOCI][MAX_COMMENT_LENGTH]);
int read_score_assoc_par(FILE *fp,par_info *pi,float *wfactor,int *use_func_weights,int use_cc_freqs[2],float *func_weight,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],int max_cc[2],int *use_locus_names,char names[MAX_LOCI][20],int *use_comments,char comments[MAX_LOCI][MAX_COMMENT_LENGTH], int *do_recessive_test,float *weight_threshold,float *LD_threshold,int *use_haplotypes);
int read_sa_par(FILE *fp,par_info *pi,sa_par_info *spi,float *func_weight,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],int max_cc[2],char names[MAX_LOCI][20],char comments[MAX_LOCI][MAX_COMMENT_LENGTH]);
void get_freqs(subject **sub,int nsub,par_info *pi,sa_par_info *spi,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],float cc_gencount[2][3][MAX_LOCI]);
void write_scores(FILE *fs,subject **sub,int nsub,float *score);
void do_recessive_HWE_test(FILE *fo,float *score,subject **sub,int nsub,par_info *pi,sa_par_info *spi,float cc_freq[2][MAX_LOCI],float cc_count[2][MAX_LOCI],int max_cc[2],float *weight,float *missing,int *old_rarer,char names[MAX_LOCI][20]);
void do_recessive_HWE_test_with_haplotypes(FILE *fo, float *score, subject **sub, int nsub, par_info *pi,sa_par_info *spi, float cc_freq[2][MAX_LOCI], float cc_count[2][MAX_LOCI], int max_cc[2], float *weight, float *missing, int *old_rarer, char names[MAX_LOCI][20]);
extern int sort_trios(subject **sub,int nsub,par_info *pi,subject **new_sub,non_mendelian *nm,int *n_non_mendelian,char *non_mendelian_report);
int read_all_gen_subjects(FILE *fi,subject **s,int *nsub,par_info *pi);
extern double cumulBinom(int N,int k,double p);
extern float weight[MAX_LOCI],missing_score[MAX_LOCI],func_weight[MAX_LOCI],cc_freq[2][MAX_LOCI],cc_count[2][MAX_LOCI],cc_genocount[2][3][MAX_LOCI];
extern int rarer[MAX_LOCI];
extern char names[MAX_LOCI][NAME_LENGTH],comments[MAX_LOCI][MAX_COMMENT_LENGTH],trios_fn[500];
#define USEFILTERS 1
#endif