# set missing genotypes ("./.") to phased ref genotypes ("0|0")
bcftools +setGT in.vcf -- -t . -n 0p
If this doesn't work, fix the ploidy first:
bcftools +fixploidy in.vcf -- -s samples.txt
From the help page:
About: Fix ploidy
Usage: bcftools +fixploidy [General Options] -- [Plugin Options]
Options:
run "bcftools plugin" for a list of common options
Plugin options:
-p, --ploidy <file> space/tab-delimited list of CHROM,FROM,TO,SEX,PLOIDY
-s, --sex <file> list of samples, "NAME SEX"
-t, --tags <list> VCF tags to fix [GT]
Example:
# Default ploidy, if -p not given. Unlisted regions have ploidy 2
X 1 60000 M 1
X 2699521 154931043 M 1
Y 1 59373566 M 1
Y 1 59373566 F 0
MT 1 16569 M 1
MT 1 16569 F 1
# Example of -s file, sex of unlisted samples is "F"
sampleName1 M
bcftools +fixploidy in.vcf -- -s samples.txt