diff --git a/src/utils/FileRecordTools/FileReaders/InputStreamMgr.cpp b/src/utils/FileRecordTools/FileReaders/InputStreamMgr.cpp index 1f9d044108c5349ee6c5dc8e91143290460ab3e2..5b1d0a9c10831dcfc123efe560ec86acf4fbac3b 100644 --- a/src/utils/FileRecordTools/FileReaders/InputStreamMgr.cpp +++ b/src/utils/FileRecordTools/FileReaders/InputStreamMgr.cpp @@ -204,10 +204,7 @@ bool InputStreamMgr::detectBamOrBgzip(int &numChars, int currChar) _bamReader = new BamTools::BamReader(); - _bamReader->OpenStream(_finalInputStream); - QuickString bamHeader(_bamReader->GetHeaderText()); - - if (bamHeader.empty()) { + if (!_bamReader->OpenStream(_finalInputStream)) { //This is NOT a bam file, but it is bgzipped. _pushBackStreamBuf->clear(); //Put all bytes read so far back onto the scan buffer, then reset diff --git a/test/intersect/gdc.bam b/test/intersect/gdc.bam new file mode 100644 index 0000000000000000000000000000000000000000..80dcfaa0b3080652c64d10497e4ecfb4e223a389 Binary files /dev/null and b/test/intersect/gdc.bam differ diff --git a/test/intersect/gdc_exp b/test/intersect/gdc_exp new file mode 100644 index 0000000000000000000000000000000000000000..442b7f2864a8465c0cf1dbd8ca6100bb83fcad36 --- /dev/null +++ b/test/intersect/gdc_exp @@ -0,0 +1,12 @@ +chr2L 10 15 None 255 + 10 15 0,0,0 1 5, 0, +chr2L 70 75 None 255 - 70 75 0,0,0 1 5, 0, +chr2L 70 75 None 255 - 70 75 0,0,0 1 5, 0, +chr2L 140 145 None 255 - 140 145 0,0,0 1 5, 0, +chr2L 140 145 None 255 - 140 145 0,0,0 1 5, 0, +chr2L 150 155 None 255 - 150 155 0,0,0 1 5, 0, +chr2L 210 215 None 255 + 210 215 0,0,0 1 5, 0, +chr2L 70 75 None 255 + 70 75 0,0,0 1 5, 0, +chr2L 70 75 None 255 + 70 75 0,0,0 1 5, 0, +chr2L 140 145 None 255 + 140 145 0,0,0 1 5, 0, +chr2L 140 145 None 255 + 140 145 0,0,0 1 5, 0, +chr2L 160 165 None 255 + 160 165 0,0,0 1 5, 0, diff --git a/test/intersect/new_test-intersect.sh b/test/intersect/new_test-intersect.sh index 056278b41033e6f94c9373e7b4a1e2136019e2e6..85c6a8bbbf77c8f3f2ff7600bf8f6c4cc01efb4b 100755 --- a/test/intersect/new_test-intersect.sh +++ b/test/intersect/new_test-intersect.sh @@ -605,6 +605,15 @@ check obs exp rm obs exp +########################################################### +# Test that we can process a Bam file with no text in +# it's header. +############################################################ +echo " intersect.new.t53...\c" +$BT intersect -a gdc.bam -b gdc.bam -bed > obs +check obs gdc_exp +rm obs +