modified: FGI/OYK.pm
[GalaxyCodeBases.git] / tools / etc / vcf_downgrade.sh
blob0013e80a5f53986149ce74e85c1766cee22ff0a4
1 # If you are trying to view VCF 4.2 files in IGV - you may run into issues. This function might help you.
2 # This script will:
3 # 1. Rename the file as version 4.1
4 # 2. Replace parentheses in the INFO lines (IGV doesn't like these!)
6 function vcf_downgrade() {
7 outfile=${1/.bcf/}
8 outfile=${outfile/.gz/}
9 outfile=${outfile/.vcf/}
10 bcftools view --max-alleles 2 -O v $1 | \
11 sed "s/##fileformat=VCFv4.2/##fileformat=VCFv4.1/" | \
12 sed "s/(//" | \
13 sed "s/)//" | \
14 sed "s/,Version=\"3\">/>/" | \
15 bcftools view -O z > ${outfile}.dg.vcf.gz
16 tabix ${outfile}.dg.vcf.gz