I also came across the 'missing header' error. I found that that when converting BAM-> SAM, I had forgotten about printing the headers. This fixed it for me:
BAM -> SAM:
SAM -> BAM (even SAM produced from BWA):
BAM -> SAM:
Note : -h print header for the SAM output
Code:
samtools view -h in.bam > out.sam
SAM -> BAM (even SAM produced from BWA):
Code:
samtools view -bS in.sam > out.bam
Comment