Edit vcf file 0|0 to 0

Edit vcf file 0|0 to 0

1

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

• 33 views

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'


Login
before adding your answer.

Read more here: Source link