This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to populate snp vcf file

Hello everyone. I have a vcf file of snp obtained by gatk. In the GT column in the file appears some ./. I would like to ask:

  1. How to fill these ./. (for example, is there a way to predict the possibility of these ./. based on the general trend, or other solutions)
  2. Why does this happen?

Any help would be greatly appreciated

vcf snp gatk

Why does this happen?

not enough data : eg; homozygous deletion, low coverage, etc...

1 answer

You could use bcftools plugins:

https://samtools.github.io/bcftools/howtos/plugins.html

for example:

bcftools +setGT --help

prints:

About: Sets genotypes. The target genotypes can be specified as:
           ./.  .. completely missing ("." or "./.", depending on ploidy)
           ./x  .. partially missing (e.g., "./0" or ".|1" but not "./.")
           .    .. partially or completely missing
           a    .. all genotypes
           b    .. heterozygous genotypes failing two-tailed binomial test (example below)
           q    .. select genotypes using -i/-e options
       and the new genotype can be one of:
           .    .. missing ("." or "./.", keeps ploidy)
           0    .. reference allele (e.g. 0/0 or 0, keeps ploidy)
           c:GT .. custom genotype (e.g. 0/0, 0, 0/1, m/M, overrides ploidy)
           m    .. minor (the second most common) allele (e.g. 1/1 or 1, keeps ploidy)
           M    .. major allele (e.g. 1/1 or 1, keeps ploidy)
           p    .. phase genotype (0/1 becomes 0|1)
           u    .. unphase genotype and sort by allele (1|0 becomes 0/1)
Usage: bcftools +setGT [General Options] -- [Plugin Options]
Options:
   run "bcftools plugin" for a list of common options

Plugin options:
   -e, --exclude <expr>        Exclude a genotype if true (requires -t q)
   -i, --include <expr>        include a genotype if true (requires -t q)
   -n, --new-gt <type>         Genotypes to set, see above
   -t, --target-gt <type>      Genotypes to change, see above

Example:
   # set missing genotypes ("./.") to phased ref genotypes ("0|0")
   bcftools +setGT in.vcf -- -t . -n 0p

   # set missing genotypes with DP>0 and GQ>20 to ref genotypes ("0/0")
   bcftools +setGT in.vcf -- -t q -n 0 -i 'GT="." && FMT/DP>0 && GQ>20'

   # set partially missing genotypes to completely missing
   bcftools +setGT in.vcf -- -t ./x -n .

   # set heterozygous genotypes to 0/0 if binom.test(nAlt,nRef+nAlt,0.5)<1e-3
   bcftools +setGT in.vcf -- -t "b:AD<1e-3" -n 0

   # force unphased heterozygous genotype if binom.test(nAlt,nRef+nAlt,0.5)>0.1
   bcftools +setGT in.vcf -- -t ./x -n c:'m/M'

Log in to answer this question.