Convert a BAM from GRCh37 to hg19?
1
0
Entering edit mode
2.5 years ago

Hello!

I was about to re-run the mapping step to create BAM files with hg19 coordinates, but realised that perhaps it's easier to convert the existing GRCh37 BAM files to hg19 coordinates, without having to re-run the aligner completely.

I looked around for ways to do this but only find methods for creating chain files e.g. hg19-h38.

I would greatly appreciate some help with this. :-]

Joel

GRCh37 hg19 BAM • 2.2k views
ADD COMMENT
1
Entering edit mode

GRCh37 is hg19. hg19 is simply a synonym.

Edit: I should add that the major genome build is identical. There are specific differences in some components noted in my comment below.

See: https://www.ncbi.nlm.nih.gov/assembly/GCF_000001405.13/

ADD REPLY
0
Entering edit mode

I was under the impression that chrM was actually different between the two?

ADD REPLY
1
Entering edit mode

While major genome builds are identical there are specific differences in non-chromosomal members: https://gatk.broadinstitute.org/hc/en-us/articles/360035890711-GRCh37-hg19-b37-humanG1Kv37-Human-Reference-Discrepancies

There is a comparison table.

ADD REPLY
0
Entering edit mode
ADD REPLY
3
Entering edit mode
2.5 years ago

I ended up using samtools reheader, as the chromosomes seemed similar enough. I ended up wasting some hours thinking reheader ONLY changed the header section. I wish the samtools documentation was better... turns out reheader changes the chromosome names everywhere in the file.

Thanks for your help though, I found salvation much faster thanks to you :-]

My command in case someone is curious:

samtools reheader -c "sed -e 's/SN:\([0-9XY]\+\)/SN:chr\1/' -e 's/SN:MT/SN:chrM/'" h37.bam > hg19.bam
ADD COMMENT
1
Entering edit mode

Thanks for sharing the solution!

ADD REPLY
0
Entering edit mode

Correction: I changed the * to \+, elsewise lots of things went wrong... sorry!

ADD REPLY

Login before adding your answer.

Traffic: 1679 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6