Edit vcf file 0|0 to 0
1
0
Entering edit mode
2.6 years ago
zoubda • 0

I have a vcf file with GT format as 0|0 0|1 1|1 etc. I would like to convert those to a single number to create a dosage file. Ex: Editing the vcf so that 0|0 become 0, 0|1 becomes 1 1|1 becomes 2 etc. I've tried using sed and gsub but can't seem to figure it out. Any advice would be greatly appreciated

linux vcf genomics edit • 688 views
ADD COMMENT
1
Entering edit mode
2.6 years ago
bcftools annotate -x 'QUAL,INFO,^FORMAT/GT' in.vcf | sed 's/0[\/\|]0/0/g;s/0[\/\|]1/1/g;s/1[\/\|]1/2/g'
ADD COMMENT
0
Entering edit mode

It worked, thanks so much!

ADD REPLY

Login before adding your answer.

Traffic: 2144 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