#ifndef __MISSINGTRIO_H_ #define __MISSINGTRIO_H_ #include #include #include #include #include "genotypetrio.h" #include "matrix.h" #include "missing.h" using namespace std; class Missingtrio // record all possible haplotype that is compatible with the observed genotype { private: // enumerate all possible trio_code that have the same missing patten as specified in original vector missing_pat_trio_genotype; int count; int size; int ind_clus; int ind_1df; public: int typed_o; int typed_par1; int typed_par2; Missing * M_offspring; Missing * M_par1; Missing * M_par2; double **weight; // dimension dim * missing_pat_trio_genotype.size(), row: haplotype; col: possible trio genotypes double *gfreq; // dimension missing_pat_trio_genotype.size() double **centmatrix; // variance double **derivative; // F_p double **deriv1; double **deriv2; double **deriv3; double **derivative_clus; // clustered haplotypes double **deriv1_clus; double **deriv2_clus; double **deriv3_clus; double **derivative_1df; // clustered haplotypes double **deriv1_1df; double **deriv2_1df; double **deriv3_1df; vector sites; // record which row and column should be kept in the IQLS int dim; vector nonzero; // record the entry of missing_pat_trio_genotype if at lest one weight is nonzero /* Constructor */ Missingtrio(Missing * M_offspring, Missing * M_par1, Missing * M_par2, int typed_o, int typed_par1, int typed_par2, const map & hap_list, const vector & content, int size); Missingtrio(Missing * M_offspring, int typed_o, int typed_par1, int typed_par2, const map & hap_list, const vector & content, int size); void set_vec(); void set_weight(map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map, int **count); void compute_centmatrix(map & hap_freq_table, double *freq, map, double> & geno_freq_table); void compute_derivative(map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map, int **count, double **rst, double ***hst); void compute_deriv1to3(map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map, int **count, double **rst, double ***drst); void compute_derivative_cluster(map & hap_freq_table, double **mul_clus, int col_clus); void compute_deriv1to3_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 compute_deriv1to3_1df(map & hap_freq_table, double **mul_1df, int col_1df); void keep(const map & hap_list, const vector & content); // determin which row should be kept // vector *indpendent_loc(const vector & missing_site, const map & hap_list, const vector & content, int last); void show_gstat(); void expected_hap_num(map & hap_freq_table, double *freq, map, double> & geno_freq_table, map, int> & hap_pair_map, int **count); void cond_par1_one(double **result, map & hap_freq_table, map, double> & geno_freq_table, map & hap_map); void cond_par1_two(double **result, map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map); void cond_par2_one(double **result, map & hap_freq_table, map, double> & geno_freq_table, map & hap_map); void cond_par2_two(double **result, map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map); void cond_off_one(double **result, map & hap_freq_table, map, double> & geno_freq_table, map & hap_map); void cond_off_two(double **result, map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map); void cond_parents_one(double ***result, map & hap_freq_table, map, double> & geno_freq_table, map & hap_map); void cond_parents_two(double ***result, map & hap_freq_table, map, double> & geno_freq_table, map, int> & hap_pair_map); const vector & get_missing_pat_trio_genotype() { return missing_pat_trio_genotype; } int get_num() { return count; } void increase_num() { count++; } ~Missingtrio(); // delete private: vector *complete_missing_haplotype(int *hcode, int index=0); }; int is_in(vector & s, int m); #endif