How to convert the .vcf (imputed) file with GT:GP format to GT:DS? I have the genotyped data from impute2 output in .gen format (imputed to 1000G P3). The file has genotype posterior probabilities (GP:3 values per variant). I have converted .gen to .vcf using qctools and the .vcf file has GT:GP format. I need to convert the .vcf file with GT:GP format to GT:DS. Genotype dosages are recommended for use in qtltools/fastqtl analysis. However, I cannot find a tool that would keep the .vcf format and convert GP to DS. Any help much appreciated!
You can do this in Hail.

Here's the rough code to do it (0.1 versions).

Setup:

from hail import *
hc = HailContext()


Import the .gen file. VCF works too:

dataset = hc.import_gen(
    'src/test/resources/example.gen', 
    'src/test/resources/example.sample')


Remap the genotype schema and export to VCF:

dataset.annotate_genotypes_expr('g = {GT: g.call(), DS: g.dosage()}')\
    .export_vcf('/tmp/out.vcf.bgz')


Take a look at the getting started page if you want to try it out!

I should note that you may be able to do QTL analyses in Hail, depending on the method you want to use. See blog post here.