I have two separate vcf files (single individual each file, same individual ID for both files) that I would like to merge into a single vcf file. The vcf files contain SNPs that overlap in most positions. Using vcftools or bcftools concatenate functions, I can merge the two files into one and keep duplicate positions or exclude them (e.g. by only taking the first SNP), but I cannot create a consensus, for example if vcf file 1 is homozygous for one allele, and file 2 for the other allele at the same SNP, then I would like the merged vcf to be heterozygous for that SNP, containing both alleles. Is this possible using one of the available tools?
Thank you. I tried this, but it removes duplicates instead of merging them and using the allelic information of both files. From what I can see, it just takes the first instance of the SNP (e.g. genotype 0/0 at SNP derived from vcf file 1 is retained), and then removes the other instance (e.g. genotype 0/1 at same SNP derived from vcf file 2 disappears), rather than merging them (the consensus for the two genotypes would be 0/1). This means that with this command no consensus genotype is built.