Q: Error converting vcf to hap
1
0
Entering edit mode
4.4 years ago
anailis • 0

Hello. I am trying to convert a .vcf containing phased data to SHAPEIT .hap/.sample format using bcftools or Plink2.

bcftools convert input.vcf --hapsample output.hap

OR

plink2 --vcf input.vcf --export haps --out output.hap

PLINK gives the error "--exports haps cannot be used with missing genotype calls" and bcftools gives the error "FORMAT/GT tag not present at [chr.no]:[SNP:id]". My vcf is using genotype probabilities (GP) not genotype (GT). My .vcf was produced from a .bgen using qctools:

qctool -g input.bgen -s input.sample -incl-rsids snps.txt -incl-samples sample.txt -og output.vcf

A snapshot of my .vcf looks like:

##fileformat=VCFv4.2
##FORMAT=<ID=GP,Type=Float,Number=G,Description="Genotype call probabilities">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  [sample-id] ...
.   11944   rs10172629,2    C   T   .   .   .   GP  [sample-genotype] ...

Sample genotypes are in the form 0,1,0,1 etc where 0 and 1 refer to the possible alleles.

software error plink • 3.3k views
ADD COMMENT
0
Entering edit mode

Added plink tag.

Do you need the GPs or would you prefer GTs? To obtain GTs, I think that you just need to add the threshold parameter to the qctool command.

Also, in place of qctool, you could try shapeit -convert (for producing the VCF)

ADD REPLY
4
Entering edit mode
4.4 years ago

Two issues:

  • When importing a VCF, plink2's default behavior is to just look at the GT field, since (i) that corresponds to what most researchers use plink for, and (ii) there are several different ways to represent dosages and genotype posterior probabilities, and those standards are continuing to evolve. You need to replace "--vcf input.vcf" with "--vcf input.vcf dosage=GP" to import GP values instead.
  • The .hap file format requires every single genotype call to be phased. GP cannot represent genotype phase at all! So you'll either need to actually run e.g. SHAPEIT4 to phase your data first, or you need to obtain a different file to start with.
ADD COMMENT
0
Entering edit mode

Thank you for your response. I think I should have been working with GT.

ADD REPLY

Login before adding your answer.

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