<p>Dear All,</p>

<p>I am using <a href='http://samtools.sourceforge.net/SAM1.pdf'>BAM</a> files for chip-seq analysis. The chromosome notation in a usual <a href='http://samtools.sourceforge.net/SAM1.pdf'>BAM</a> file is like: chr1. In my file the  chromosomme notation is 1. Is there a way to change that in the <a href='http://samtools.sourceforge.net/SAM1.pdf'>BAM</a> file? For further analysis it is very important to change the notation.</p>

<p>Many thanks!</p>

<p>Greetz Lisanne</p>

Edit: ~10 years later.

Some options:

**1)** See I wrote http://lindenb.github.io/jvarkit/ConvertBamChromosomes.html

**2)** You can use `samtools view` to dump your data with the header: http://samtools.sourceforge.net/samtools.shtml and replace the chromosomes with `sed` or `awk`. (**not tested** but it could be something like below):

    samtools view -h file.bam |\
    sed -e '/^@SQ/s/SN\:/SN\:chr/' -e '/^[^@]/s/\t/\tchr/2'|\
    awk -F ' ' '$7=($7=="=" || $7=="*"?$7:sprintf("chr%s",$7))' |\
    tr " " "\t"

**3)** You could also use [PICARD ReplaceSamHeader](https://gatk.broadinstitute.org/hc/en-us/articles/360036897572-ReplaceSamHeader).

**4)** If you need to work with **samtools** or the **gatk**, another hack is to create a 'mock' **faidx** index to the reference genome. See [my blog](http://plindenbaum.blogspot.com/2011/10/reference-genome-with-or-without-chr.html).