I have a WES BAM file and I want to filter this using a BED file
bedtools intersect -abam NA12878.bam -b BRCA1-expanded.bed > ./NA_limited.bam
And I got this error
E::bgzf_flush] File write failed (wrong size)
terminate called after throwing an instance of 'std::runtime_error'
what(): can't write alignment record
Aborted (core dumped)
Can you check if you have write permissions in the folder where you are writing the output?
It runs for a while and the output file is created but a few minutes after starting running, the error occurs.