#ifndef __IQLAESTIMATOR_H_ #define __IQLAESTIMATOR_H_ #include #include #include "family.h" #include "missing.h" #include "function.h" #include "matrix.h" class IQLAEstimator{ private: FILE *outfp; map hap_freq_table; // record haplotype frequencies map, double> geno_freq_table; int loci_num; int sample_size; vector & fam_list; vector & complete_geno_list; vector & geno_list; // unique observed genotype vector & missing_list; // store the unique missing pattern, unit is one genotype map geno_missing_map; // record which missing patten does each genotype belong map pair_missing_v; map, int> pair_missing_IBD1; map, int> pair_missing_IBD2; int **count; // record how many copies of h_k in pair of haplotypes (i,j), demension (a-1) * a(a+1)/2, entries are 0, 1 or 2 double test; double *Btest; double pvalue; double *Bpvalue; double minpvalue; int df; int col_1df; int test_perform; int flag_pd; map, int> hap_pair_map; double **rst; // record derivative for each pair of haplotypes double *freq; double **L; double ***V; double ***mat_cov_1; double ***mat_cov_2; double **denominator; double *numerator; int tot_dim; double **cholent; double **chol; double **cholaug; double **covMatrix; public: int aff; int unaff; int unknown; map aff_hap_freq_table; map unaff_hap_freq_table; map unknown_hap_freq_table; map full_hap_freq_table; map aff_hap_freq_table_EW; map unaff_hap_freq_table_EW; map unknown_hap_freq_table_EW; map full_hap_freq_table_EW; IQLAEstimator(vector & fam_list, vector & complete_geno_list, vector & geno_list, vector & missing_list, map & hap_list, int size); void init_freq_table(); void reset_freq_table(map & hap_freq); void show_incom_geno_freq(); void show_hap_freq(); void show_hap_freq(vector &a0v, vector &a1v); void show_geno_freq(); void update_hap_freq(); void update_geno_freq(); const map & get_hap_freq(){ return hap_freq_table; } int get_loci_num(){ return loci_num; } int get_sample_size(){ return sample_size; } double get_p_value(){ return pvalue; } double get_min_p_value(){ return minpvalue; } void show_test(vector *cluster, vector &a0v, vector &a1v); void allocate(); void NR_Iteration_new(); void Score_test_new(); int Score_test_cluster_new(vector *cluster); void deallocate(); void set_output(FILE *fp){ outfp = fp; } void estimate_subgroup(); void NR_Iteration_subgroup(int group); void print_subgroup(vector &a0v, vector &a1v); void NR_Iteration_EW(); void estimate_subgroup_EW(); void NR_Iteration_subgroup_EW(int group); void print_subgroup_EW(vector &a0v, vector &a1v); void single(); void single_Score_test(); ~IQLAEstimator(); private: void compute_count(); void geno_missing_patten(); void pair_missing_pattern(); }; #endif