bedtools2: Non-writable IO device error when intersecting BAM and BED files

I have a sorted BAM file that I want to filter for reads not overlapping regions in a BED file. However, the following error occurs:

bedtools intersect -a sample.bam -b regions.bed -v > reads.not.in.regions.bam
terminate called after throwing an instance of 'std::runtime_error'
  what():  BgzfStream::Write() - trying to write to non-writable IO device

I have plenty of space to write the files, and if I do not specify an output file it prints to the console.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

Same problem here, cannot directly output bam to NFS storage, only bed. Local storage is fine. My current workaround is pipe to stdout and then use samtools view.