Split Multiple Samples In Vcf File Generated By GATK

I use bcftools version 1.6 where the latest version can be downloaded at https://samtools.github.io/bcftools/

Original file (test.genotypecalls.vcf) has 4 samples:

split_original

#!/bin/bash
file="test.genotypecalls.vcf"

for sample in `bcftools query -l $file`; do
  bcftools view -c1 -Oz -s $sample -o  ${file/.vcf*/.$sample.vcf.gz} $file
done

Results:
4 vcf.gz files have been generated.

test.genotypecalls.vcf
test.genotypecalls.A160251_Pro.vcf.gz
test.genotypecalls.A160252_Sib.vcf.gz
test.genotypecalls.A160253_Mot.vcf.gz
test.genotypecalls.A160254_Fat.vcf.gz

One sample [A160251_Pro] of split individual file content:

split_output