This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Does header replacement have an effect on alignment part in a BAM file?

Hi, Does a change of BAM header (using the reheader funcion of GALAXY genome) change the alignment data? Thanks, Tal

header bam

1 answer

It can, yes. You can change the names of chromosomes (e.g., "chr1" -> "1"), but don't change their order or remove chromosomes/contigs, since that'll screw up the alignments.

Hi Devon, Thanks for your answer. My strategy for changing the names of chromosomes is to change the header of the file (I am replacing the header with another header of BAM files with chr prefix and I am wondering if this step will damage the data; in both cases the reads are arranged according to their coordinates)

As long as you're only adding/removing "chr" (or changing "MT" to "chrM") then you'll be OK. That won't mess up any of the alignments. The alignments themselves don't actually contain the chromosome name that they're aligned to. They just contain a number saying which chromosome in the header they're on. So changing names is fine, but if you happen to change the order at all then the number held in the alignments will suddenly be the wrong chromosome (this has caused a number of people to have very very bad days).

Log in to answer this question.