void HotspotReader::MakeHintQueue(const string& hotspot_vcf_filename) { // go through the entire vcf to generate the blacklist ifstream hotspot_vcf; hotspot_vcf.open(hotspot_vcf_filename.c_str(), ifstream::in); string bstrand = "BSTRAND"; while (!hotspot_vcf.eof()) { string line; getline(hotspot_vcf, line); if (line[0] != '#') { // look for the BSTRAND tag size_t found = line.find(bstrand); if (found != string::npos) { // found BSTRAND, look for semicolon delimiter or end of line long int hint = NO_HINT; size_t semicolon_pos = line.find(";", found+bstrand.size()); if (semicolon_pos == string::npos) semicolon_pos = hotspot_vcf.gcount()-1; // impute a semicolon at the end of the line // look for the code B size_t b_pos = line.find("B", found+bstrand.size()); // look for the code R size_t r_pos = line.find("R", found+bstrand.size()); // look for the code F size_t f_pos = line.find("F", found+bstrand.size()); bool blacklist = false; if (f_pos < semicolon_pos) { hint = FWD_BAD_HINT; } if (r_pos < semicolon_pos) { hint = REV_BAD_HINT; } if (b_pos < semicolon_pos){ hint = BOTH_BAD_HINT; } if ( (f_pos < semicolon_pos) && (r_pos < semicolon_pos)){ hint = BOTH_BAD_HINT; } // blacklist this position if (hint != NO_HINT) { // #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT [SAMPLE1 .. SAMPLEN] vector<string> fields = split(line, '\t'); string sequenceName = fields.at(0); char* end; // dummy variable for strtoll long int pos = strtoll(fields.at(1).c_str(), &end, 10); long int chrom_idx = ref_reader_->chr_idx(sequenceName.c_str()); vector<long int> hint_entry (3, NO_HINT); hint_entry[0] = chrom_idx; hint_entry[1] = pos-1; hint_entry[2] = hint; hint_vec.push_back(hint_entry); } } } } // std::cout << "BL size: " << hint_vec.size() << endl; }
const char *hint_to_name(glui32 hint) { #define hint_entry(this) switch_entry(stylehint, hint_name, this) switch(hint) { hint_entry(Indentation); hint_entry(ParaIndentation); hint_entry(Justification); hint_entry(Size); hint_entry(Weight); hint_entry(Oblique); hint_entry(Proportional); hint_entry(TextColor); hint_entry(BackColor); hint_entry(ReverseColor); default: return "WTF"; break; } }