After merging 6 bam files (samtools merge) I attempted to look at the read depth within a specific set of intervals and got the following error, not sure exactly why expect maybe the merge tool takes a sam and not a bam file?
samtools depth -b --bed /sonas-hs/tollkuhn/hpc_norepl/home/rbronste/refGene/promoter_example.bed /sonas-hs/hpc_norepl/home/rbronste/h_merged.bam /sonas-hs/hpc_norepl/home/rbronste/B_merged.bam [bam_header_read] EOF marker is absent. The input is probably truncated. [bam_header_read] invalid BAM binary header (this is not a BAM file). Segmentation fault (core dumped)