#ifndef __MISSING_H_ #define __MISSING_H_ #include #include #include #include #include "genotype.h" #include "matrix.h" using namespace std; class Missing{ // record all possible haplotype that is compatible with the observed genotype private: int *gcode; // enumerate all possible gcode that have the same missing patten as specified in missing_site vector missing_pat_genotype; int count; int size; int ind_clus; int ind_1df; public: double **weight; // demension dim * missing_pat_genotype.size(), row: haplotype; col: possible genotypes double *gfreq; // dimension missing_pat_genotype.size() double **centmatrix; // variance double **derivative; // F_p double **derivative_clus; // clustered haplotypes double **derivative_1df; // 1-df test matrix vector sites; // record which row and column should be kept in the IQLS int dim; vector nonzero; // record the entry of missing_pat_genotype if at lest one weight is nonzero map mapping_function; /* Constructor */ Missing(const vector & missing_site, const map & hap_list, const vector & content, int size); void set_weight(map, double> & geno_freq_table, map, int> & hap_pair_map, int **count); void compute_centmatrix(double *freq, map, double> & geno_freq_table); void compute_derivative(map & hap_freq_table, map, int> & hap_pair_map, int **count, double **rst); void compute_derivative_cluster(map & hap_freq_table, double **mul_clus, int col_clus); void compute_derivative_1df(map & hap_freq_table, double **mul_1df, int col_1df); void keep(const vector & missing_site, const map & hap_list, const vector & content); // determin which row should be kept const vector & get_missing_pat_genotype(){ return missing_pat_genotype; } int *get_gcode(){ return gcode; } int get_num(){ return count; } void increase_num(){ count++; } ~Missing(); // delete private: vector *complete_missing_genotype(int index=0); vector *complete_missing_haplotype(int *hcode, int index=0); }; int find_element(const vector & s_vec, int m); #endif