I've filtered my .bam file for uniquely mapped reads with this command:
samtools view file.bam | grep "XT:A:U" > file.unique.bam
Then I wish to convert the .unique.bam file to .bed file with Bedtools but failed. The command I used is:
bamToBed -i file.unique.bam > file.bed
And I got error message like:
BgzfStream ERROR: read block failed - invalid block header
BamHeader ERROR: could not read magic number
BamReader ERROR: Could not load header data for file.sorted.unique.bam
It seems with the grep command I left out the header of the bam file. Can anyone tell me how to fix this problem? Thank you!
samtools view file.bam | grep "XT:A:U" > file.unique.bam
Then I wish to convert the .unique.bam file to .bed file with Bedtools but failed. The command I used is:
bamToBed -i file.unique.bam > file.bed
And I got error message like:
BgzfStream ERROR: read block failed - invalid block header
BamHeader ERROR: could not read magic number
BamReader ERROR: Could not load header data for file.sorted.unique.bam
It seems with the grep command I left out the header of the bam file. Can anyone tell me how to fix this problem? Thank you!
Comment