I currently have a VCF with data similar to the below. I can turn this VCF into a new VCF that has genotypes, and I can turn it into a new VCF that has rsIDs, but I can't seem to figure out how to turn this VCF into one that has both.
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT RGSM chr10 65878 . C G 6.98 . AC=2;AF=1;AN=2;DP=1;FS=0;MQ=48;QD=6.98;SOR=1.609;FractionInformativeReads=1 GT:AD:AF:DP:GQ:PL:GL:GP:PRI:SB:MB 1/1:0,1:1:1:2:41,3,0:-4.077,-0.301,0:6.977,3.987,3.978:0,34.77,37.77:0,0,1,0:0,0,1,0 chr10 66040 . CAG C 36.3 . AC=1;AF=0.5;AN=2;DP=4;FS=0;MQ=42.8;MQRankSum=0.736;QD=9.08;ReadPosRankSum=0.736;SOR=2.225;FractionInformativeReads=0.75;R2_5P_bias=10.37 GT:AD:AF:DP:GQ:PL:GL:GP:PRI:SB:MB 0/1:1,2:0.667:3:9:75,0,5:-7.466,0,-0.495:36.3,0.6469,8.596:0,39,42:1,0,0,2:1,0,0,2 chr10 66957 . C T 6.59 . AC=1;AF=0.5;AN=2;DP=3;FS=0;MQ=24.04;MQRankSum=-0.736;QD=2.2;ReadPosRankSum=-0.736;SOR=0.223;FractionInformativeReads=1;R2_5P_bias=-6.11 GT:AD:AF:DP:GQ:PL:GL:GP:PRI:SB:MB 0/1:1,2:0.667:3:7:40,0,28:-4.028,0,-2.834:6.591,1.078,32.42:0,34.77,37.77:0,1,1,1:1,0,1,1 chr10 71282 . A C 13.64 . AC=2;AF=1;AN=2;DP=2;FS=0;MQ=17;QD=6.82;SOR=0.693;FractionInformativeReads=1 GT:AD:AF:DP:GQ:PL:GL:GP:PRI:SB:MB 1/1:0,2:1:2:4:49,6,0:-4.946,-0.599,0:13.64,4.95,1.959:0,34.77,37.77:0,0,1,1:0,0,1,1
For reference, this is the kind of format I would like the final VCF to be in (variants are not the same across these two example but you catch my drift):
#chrom pos id ref alt qual filter info format GENOTYPE genotype_final chr1 734462 rs12564807 G A . . . GT 1/1 GG chr1 752721 rs3131972 A G . . . GT 1/1 AA chr1 760998 rs148828841 C . . . . GT 0/0 CC chr1 776546 rs12124819 A . . . . GT 0/0 AA
I've used bcftools annotate command in conjunction with annotate Homo_sapiens_assembly38.dbsnp138.vcf to get rsIDs from my file, and I've used bcftools query command to try and pull the genotypes out of the original VCF file. Both of these things have been successful on their own, but I just can't figure out how to combine the two of them together to get the data into the format shown above. Any help would be very appreciated, I've spent a lot of time on this so far to no avail.