Bug in intersectBed: tab added at the end of every record

84 views
Skip to first unread message

Ivan

unread,
Mar 3, 2010, 5:23:32 PM3/3/10
to bedtools-discuss
Hello everybody,

I just discovered a nasty invisible bug in intersectBed.

I did

intersectBed -abam A.bam -b B.bed > C.bam

Now, if you do

samtools view C.bam | head

outputting to screen, it will all look normal and successful but it
you try to catch that text output and repack it into BAM, it will
complain:

"missing colon in auxiliary data"

If I do

samtools view C.bam | head > ten_records.txt

I can open the txt and see the nasty tabs at the end of every line.

Basically, intersectBed works but the output BAM is not usable.

No matter how nasty you consider this bug, BEDTools is still
outstanding.

Big thanks to Aaron.

Ivan

Pratap, Abhishek

unread,
Mar 3, 2010, 5:26:58 PM3/3/10
to bedtools...@googlegroups.com
Hi Ivan

I haven't really done what Ivan is reporting here but I routinely use subset of bam file generated by intersectBed for viewing in IGV or pileups and they seem to work fine.

-Abhi

Aaron Quinlan

unread,
Mar 3, 2010, 5:31:20 PM3/3/10
to bedtools...@googlegroups.com
Hi Ivan,
I do this sort of this all the time with no issues. That said, I typically work with BAM files created by BWA, Novoalign and Mosaik. Are you working with a different aligner? If so, could you give me the version numbers (both for the aligner, samtools, and for BEDTools) and some sample data?

This is worrisome...

Aaron

Aaron Quinlan, Ph.D.
NRSA Postdoctoral Fellow
Hall Laboratory
University of Virginia
Biochem. & Mol. Genetics
aaronq...@gmail.com

Aaron Quinlan

unread,
Mar 3, 2010, 5:41:25 PM3/3/10
to bedtools...@googlegroups.com
Just a thought: are you certain that this issue does not also exist in your A.bam file? The "missing colon in auxiliary data" error reeks of a malformed TAG generated by an aligner.

Aaron


On Mar 3, 2010, at 5:23 PM, Ivan wrote:

Aaron Quinlan

unread,
Mar 3, 2010, 6:03:14 PM3/3/10
to bedtools...@googlegroups.com
Ivan,
I stand corrected, I now see the error. I never had a case where I used samtools view on your "C.bam" file and piped it into another "samtools view -Sb -". I think this bug was created by the latest tweaks I made to the BAM reading and writing classes. I will try to correct this asap. I am surprised that samtools doesn't complain when just doing a "samtools view" on the original C.bam file.

Thanks so much for bringing this up and sorry for doubting you!

Aaron


On Mar 3, 2010, at 5:23 PM, Ivan wrote:

Reply all
Reply to author
Forward
0 new messages