Last active
September 9, 2015 01:22
-
-
Save astatham/d3e45ba60cc19a1adc18 to your computer and use it in GitHub Desktop.
Convert a hg19 vcf to a b37d5 vcf - only handles chr1-22, X, Y & M
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 -e | |
if [[ ! -f "${1}" ]] ; then | |
echo "File $1 does not exist, aborting." | |
exit 1 | |
fi | |
# Replace double digit chromosomes first | |
cmd="sed" | |
for i in `seq 10 22` `seq 1 9` X Y; do | |
cmd="$cmd -e 's/chr$i/$i/g'" | |
done | |
# chrM to chrMT | |
cmd="$cmd -e 's/chrM/MT/g'" | |
# Add input and output | |
cmd="$cmd $1 > ${1%.vcf}.b37d5.vcf" | |
# Execute | |
echo $cmd | |
eval $cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cheers. shouldn't that be
's/chrM/MT/g'