If I have multiple SAM files without header, and a header saved in a separate file, how do I convert that to a BAM file?
One solution is to create intermediate files:
for samfile in *.sam
cat my_header > tmp.sam
cat $samfile >> tmp.sam
samtools view -b tmp.sam > $samfile.bam
But that seems inelegant and I feel like I'm missing the better way.