This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Coverting missing sites to reference allele using Bcftools isn't working.

I am trying to set the missing GT = . to 0|0 but while using bcftools I end up only with GT as single 0 in all the missing sites for all the samples.

Initial VCFs:

CHROM   POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  MA605   MA611   MA622   MA625   MA629   Ncm8    Sp154   Sp164   Sp21    Sp3 Sp76    SpNor33 ms01e   ms02g   ms03g   ms04h
1   141 .   C   T   .   .   .   GT:PG:PG_al:PI  .   .   .   0|1:0|1:C|T:10763   .   .   .   .   .   .   .   .   .   .   .   .

My script:

bcftools +setGT phasedVCF-short02.vcf.gz -- -t . --new-gt 0p > phasedVCF-short03.vcf
Filled 110671 alleles

bcftools +setGT phasedVCF-short02.vcf.gz -- -t . --new-gt 0p\n > phasedVCF-short03.vcf

bcftools +missing2ref phasedVCF-short02.vcf.gz -- -p > phasedVCF-short03.vcf

All these methods are giving the Output VCF:

CHROM   POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  MA605   MA611   MA622   MA625   MA629   Ncm8    Sp154   Sp164   Sp21    Sp3 Sp76    SpNor33 ms01e   ms02g   ms03g   ms04h
1   141 .   C   T   .   .   .   GT:PG:PG_al:PI  0:.:.:. 0:.:.:. 0:.:.:. 0|1:0|1:C|T:10763   0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:. 0:.:.:.

I thought if something was wrong with my VCF, so downloaded VCF file over the internet to test. And I am getting the same exact result.

This is weired. What is the issue here ?

bcftools vcf software error genome genotype

1 answer

Hello,

as your missing genotype are just set to . bcftools assume that you have a monoploidy GT. So to get 0|0 you first have to set the correct ploidy.

$ bcftools +fixploidy phasedVCF-short02.vcf.gz -- -f 2|bcftools +missing2ref - -- -p > phasedVCF-short03.vcf

fin swimmer

Log in to answer this question.