Hi all,
I'm tyring to get mapped reads that overlap 100% with a feature. I have the features in a bed file and use the following command to get he overlapping reads with bedtools:
intersectBed -header -g genome_chr.txt -wb -f 1.0 -sorted -a features.bed -b mapped_reads.bam > overlapping_reads.bam
This seems to run fine, however when I try to open the bam file with "samtools view" it complains of a missing header. I tried getting the SAM header from the original mapped_reads.bam file and use samtools reheader, but I also get an error message ("[W::bam_hdr_read] EOF marker is absent. The input is probably truncated. [E::bam_hdr_read] invalid BAM binary header").
I tried with and without the -header option in bedtools, but the result is the same. The input mapped_reads.bam file has a header and works with samtools as expected. Using -bed to output bed instead of bam works, too.
Is this a bug or am I missing something?
Cheers,
Till