1 /* 2 * bcf_entry.h 3 * 4 * Created on: Sep 20, 2012 5 * Author: Anthony Marcketta 6 * ($Revision: 1 $) 7 */ 8 9 #include "output_log.h" 10 #include "entry.h" 11 #include "header.h" 12 13 extern output_log LOG; 14 15 class bcf_entry : public entry { 16 public: 17 bcf_entry(header &header_obj, vector<bool> &include_individual); 18 ~bcf_entry(); 19 20 unsigned int N_info; 21 unsigned int N_format; 22 unsigned int N_allele; 23 unsigned int L_shared; 24 unsigned int L_indiv; 25 unsigned int line_pos; 26 ostringstream outstream; 27 ostringstream tmpstream; 28 29 void parse_basic_entry(bool parse_ALT=false, bool parse_FILTER=false, bool parse_INFO=false); 30 void parse_full_entry(bool parse_FORMAT=true); 31 void parse_genotype_entry(unsigned int indv, bool GT=false, bool GQ=false, bool DP=false, bool FT=false); 32 void parse_genotype_entries(bool GT=false, bool GQ=false, bool DP=false, bool FT=false); 33 34 void set_ALT(const int n_allele); 35 void set_ALT(const string &in); 36 void set_FILTER(); 37 void set_FORMAT(); 38 void set_INFO(); 39 void set_indv_GENOTYPE_and_PHASE(unsigned int indv, const pair<string, string> &genotype, char phase); 40 void set_indv_GENOTYPE_and_PHASE(unsigned int indv, const pair<int, int> &genotype, char phase); 41 void set_indv_GENOTYPE_and_PHASE(unsigned int indv, const unsigned int &pos, const unsigned int &size); 42 void set_indv_GENOTYPE_ids(unsigned int indv, const pair<int, int> &in); 43 void set_indv_GQUALITY(unsigned int indv, const vector<char> &in); 44 void set_indv_GQUALITY(unsigned int indv, const float &in); 45 void set_indv_GFILTER(unsigned int indv, const string &in); 46 void set_indv_GFILTER(unsigned int indv, const vector<char> &in); 47 void set_indv_PHASE(unsigned int indv, char in); 48 void set_indv_GENOTYPE_alleles(unsigned int indv, const pair<int, int> &in); 49 void reset(const vector<char> &data_line); 50 51 void add_FORMAT_entry(const string &in, const unsigned int &fmt_key, const unsigned int &pos, const unsigned int &line_pos, const unsigned int &type, const unsigned int &size); 52 void read_indv_generic_entry(unsigned int indv, const string &FORMAT_id, string &out); 53 void read_indv_generic_entry(unsigned int indv, const int &idx, string &out); 54 void read_all_entries(string &out); 55 56 void filter_genotypes_by_quality(double min_genotype_quality); 57 void filter_genotypes_by_depth(int min_depth, int max_depth); 58 void filter_genotypes_by_filter_status(const set<string> &filter_flags_to_remove, bool remove_all = false); 59 60 void print(ostream &out, const set<string> &INFO_to_keep, bool keep_all_INFO=false); 61 void print_bcf(BGZF* out, const set<string> &INFO_to_keep, bool keep_all_INFO=false); 62 63 private: 64 vector<int> FILTER_str; 65 unsigned int INFO_pos, FILTER_pos, ALT_pos, FORMAT_pos; 66 }; 67