I have a vcf file and would like to extract certain chromosomes, say chr16 and only GT = 1/1. I tried using grep and it worked fine. However when I try to use these vcf files created by using grep, to compare the SNPs between 2 such files using vcftools, it shows me an error in the file format, which makes me think grep is not being able to keep the same format of vcf. Could anybody suggest the best possible way to do that?
My end goal is to compare 2 vcf files (from different samples but same chromosome 16) and find an intersection of SNPs between the files containing 1/1 genotype from say chr16.