Skip to content

Commit

Permalink
partial revert of 48105b0
Browse files Browse the repository at this point in the history
see 48105b0
that commit broke reading correct BED files
  • Loading branch information
kuk0 committed Jun 23, 2021
1 parent edcc3eb commit 6156014
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions src/utils/general/ParseTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,63 +82,6 @@ string vectorIntToStr(const vector<int> &vec) {
return str;
}


#if defined(__i386__) || defined(__x86_64__)
bool isHeaderLine(const string &line) {
if (line[0] == '>') {
return true;
}
if (line[0] == '!') {
return true;
}
if (line[0] == '#') {
return true;
}

if(line.length() > 4) {
uint32_t peek = *(uint32_t*)line.c_str() | 0x20202020u;
const char* full_text = NULL;
bool require_space = false;
bool require_digit = false;
switch(peek) {
case 0x6f726863:
full_text = "chrom";
require_space = true;
require_digit = false;
break;
case 0x20726863:
case 0x09726863:
full_text = "chr";
require_space = require_digit = true;
break;
case 0x776f7262:
full_text = "browser";
break;
case 0x63617274:
full_text = "track";
break;
case 0x69736976:
full_text = "visibility";
break;
default:
return false;
}
if(full_text) {
const char* ptr = NULL;
for(ptr = line.c_str(); *ptr && *full_text; ptr ++, full_text ++) {
char c = *ptr;
if(c >= 'A' && c <= 'Z') c += 32;
if(c != *full_text) return false;
}
if(require_space && !isspace(*(ptr++))) return false;
if(require_digit && !isdigit(*(ptr++))) return false;
return true;
}
}

return false;
}
#else
bool isHeaderLine(const string &line) {
if (line[0] == '>') {
return true;
Expand Down Expand Up @@ -172,4 +115,3 @@ bool isHeaderLine(const string &line) {
}
return false;
}
#endif

0 comments on commit 6156014

Please sign in to comment.