How can we execute the following commands with bash for a big amount of bam files in a folder
samtools view -H in.bam > header.sam
sed -i s/SN\:/SN\:chr/ header.sam
sed -i s/SN\:chrMT/SN\:chrM/ header.sam
samtools reheader header.sam in.bam > reheader_file.uns
samtools sort -o reheader_file.bam reheader_file.uns
random note: is the original bam already sorted? might not need to re-sort if so