This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Sample level genotype mapping in plink vcf output

This is a small subset of vcf file.

 `#CHROM POS   ID          REF ALT QUAL FILTER  INFO FORMAT HG00096 HG00097 HG00099
1      10583 rs58108140  G   A   25   PASS    .    GT     0/0     0/0     0/0
1      10611 rs189107123 C   G   11   q10     .    GT     0/0     0/1     0/0
1      13302 rs180734498 C   T   32   s50     .    GT     ./.     0/1     ./.
1      13327 rs144762171 G   C   30   .       .    GT     0/0     0/1     ./.
1      13957 rs201747181 TC  T   3    q10;s50 .    GT     0/0     ./.     ./.`

Is it possible to get the sample level genotype if yes how we can map those.

One simple way I can think of this

For position 10583 (rs58108140):

REF = G, ALT = A, HG00096: 0/0 = G/G (homozygous reference) HG00097: 0/0 = G/G (homozygous reference) HG00099: 0/0 = G/G (homozygous reference)

But is this the correct way of mapping those genotype information to the samples?

vcf

1 answer

bcftools query -f '[%CHROM %POS %SAMPLE %GT %TGT\n]' in.vcf.gz

It works, how does this convert the binary to actual genotype?

0 : REF
1: first ALT
2: second ALT
3 : third ALT
etc...

Log in to answer this question.