Thank you very much! My goal is to make a match in chromosome notations of my BAM file and the reference (Unfortunately, I can not use another reference genome at the moment) BAM file header format:
@HD VN:1 SO:coordinate
@SQ SN:chrM LN:1234
@SQ SN:chr1 LN:1234
@SQ SN:chr2 LN:1234
@SQ SN:chr3 LN:1234
....
...
...
Reference header format:
>1 dna:chromosome chromosome:GRCh37:1:1:1234:1
>2 dna:chromosome chromosome:GRCh37:2:1:1234:1
>3 dna:chromosome chromosome:GRCh37:3:1:1234:1
>4 dna:chromosome chromosome:GRCh37:4:1:1234:1
...
..
Then, I will try converting to SAM, reheader, then convert to BAM again and filter the non-standard chromosomes with:
samtools view -L subset.bed ....
It sounds like you have a BAM file that you need to realign to a different reference genome. Alt vs no-alt reference have different alignment behaviours and reheadering will give you different result than you would get from realigning to the 'correct' reference.