Last active
March 29, 2021 17:27
-
-
Save danielecook/f1d80babd7d601a74981 to your computer and use it in GitHub Desktop.
Downgrade VCF 4.2 to VCF 4.1 for viewing in IGV
This file contains hidden or 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
# If you are trying to view VCF 4.2 files in IGV - you may run into issues. This function might help you. | |
# This script will: | |
# 1. Rename the file as version 4.1 | |
# 2. Replace parentheses in the INFO lines (IGV doesn't like these!) | |
function vcf_downgrade() { | |
outfile=${1/.bcf/} | |
outfile=${outfile/.gz/} | |
outfile=${outfile/.vcf/} | |
bcftools view --max-alleles 2 -O v $1 | \ | |
sed "s/##fileformat=VCFv4.2/##fileformat=VCFv4.1/" | \ | |
sed "s/(//" | \ | |
sed "s/)//" | \ | |
sed "s/,Version=\"3\">/>/" | \ | |
bcftools view -O z > ${outfile}.dg.vcf.gz | |
tabix ${outfile}.dg.vcf.gz | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello, please how do you parse the input vcf file using the script and generate the output vcf file with version 4.1?