When I run script
samtools sort -@ 16 -T "path/to/temp" "$bamfile" > "$_sorted.bam, I get this error message:
[bam_sort_core] merging from 112 files and 16 in-memory blocks... samtools sort: failed to write header to "-"
and the output file is empty. I believe have sufficient memory (249G memory and my files are big around 70G pacbio reads)
Any help is appreciated.