Last active
July 21, 2022 16:45
-
-
Save opplatek/ff76ed1c64835c64e7a2dbd9b510b81a to your computer and use it in GitHub Desktop.
Quickly remap BAM (from Heng Li post https://twitter.com/lh3lh3/status/1132756684789768202)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Quickly remap reads from BAM file to new reference | |
# | |
# Source: https://twitter.com/lh3lh3/status/1132756684789768202 | |
# More details: https://janbio.home.blog/2019/05/30/useful-one-liners-collection/ | |
# | |
samtools collate -uOn128 old-pos-srt.bam tmpxyz \ | |
| samtools fastq - \ | |
| bwa mem -pt16 ref.fa - \ | |
| samtools sort --threads=4 -m4G -o new-pos-srt.bam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment