This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert BAM file from hg19 to hg38

Hello, I have a library of several hundred BAM files containing Y-sequences aligned to hg19. Now, since all major Y-players, like FTDNA, FGC, ISOGG, YBrowse... upgraded to hg38, my BAM files are pretty much useless since the SNP coordinates are according to hg38. Is there any way to convert these BAM files to hg38?

alignment sequence

I will give liftOver a try. Thank you!

I don't think liftOver works for BAM files. As I said, use `CrossMap? (I only mentioned liftOver since most people are familiar with it).

BTW, nothing is going to be as good as realigning...

2 answers

You could convert BAM to FASTQ with Picard, say, and then realign the FASTQ to hg38 with your aligner of choice.

I thought of that option but I have terabytes of data. It will take me ages with my Ryzen 1600X. If I leave the BAM files at hg19, maybe I can convert the SNP database from hg38 back to hg19. Can this be done in some automated way? My database has this format:

NAME, POSITION, ANC, DER. Is there any way to locally convert hg38 position to hg19 position? If there is, then I can write a script or a program to periodically do this for me.

Many aligners will take .bam as input, so you don't have to convert to fastq prior to realigning. But yes, converting the SNP lists would probably be easiest.

I have been using BWA and samtools for aligning FASTQ to BAM. Can you recommend some better/faster aligner?

Given that you have TBs of data, a cloud service might help you speed things up by parallelizing the work. You might look into Rainbow, Crossbow, CloudBurst or other cloud-based approaches.

Have you tried CrossMap? It's basically liftOver for things other than BED files (they use the same .chain files).

Log in to answer this question.