Question: Is there a way to reformat vcf 4.3 down to 4.2?
1
0
Entering edit mode
5.8 years ago
rdlady ▴ 40

I got a vcf file from the supplementary materials of an article but the vcf file is in vcf 4.3 format. Is there a way to convert the vcf from 4.3 to 4.2 format?

sequencing SNP ChIP-Seq • 11k views
ADD COMMENT
9
Entering edit mode
5.8 years ago

https://samtools.github.io/hts-specs/VCFv4.3.pdf

most of the changes are new official tags, the ##SAmple tag., ##pedigree etc...

if you need to process it with a tool that is not able to read 4.3 , you can try to 'just' change the version number of the of VCF.

sed 's/^##fileformat=VCFv4.3/##fileformat=VCFv4.2/' in.vcf > out.vcf
ADD COMMENT
0
Entering edit mode

That's a good idea. I was concerned that v4.3 might be too different from 4.2 but you are right, I should at least just try to change the version number in the vcf file and see if that works. Thank you! I will post an update if that works.

ADD REPLY
0
Entering edit mode

The sed command you suggested worked for the analyses I needed. Thank you again for your help!

ADD REPLY
0
Entering edit mode

I know it's been a long time since you answered but maybe you can still help me. I have the same issue but this does not seem to work for me. What am I doing wrong?

First I do this like you suggested:

LC_ALL=C sed 's/^##fileformat=VCFv4.3/##fileformat=VCFv4.2/' ALL.chr.vcf.gz > newALL.chr.vcf.gz

And then this again:

vcftools --gzvcf newALL.chr.vcf.gz --snps chr.csv --recode --out filtered_output  

Which again gives me the error

Error: VCF version must be v4.0, v4.1 or v4.2: You are using version VCFv4.3

I would be very grateful for help!

ADD REPLY

Login before adding your answer.

Traffic: 3873 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6