Merge genotypes of two vcf files
1
0
Entering edit mode
4 months ago
pablo ▴ 350

Hi,

I have two vcf files, both with the same samples and variants. They come from two methods. I need to create a new vcf file, which merges the genotypes and I will compare if they are identical or not, accordind to the method.

For example :

vcf1 : 2       13958715        AX-325448157    T       C 0/0
vcf2 : 2       13958715        AX-325448157    T       C 0/0

output : 2       13958715        AX-325448157    T       C 0/0:0/0

I used :

vcfgtcompare.sh other 1.vcf 2.vcf > test.vcf

But when I check the test.vcf file, I have wrong merging. Both vcf files are sorted, by chromosome and samples.

Any help?

vcf vcftools • 372 views
ADD COMMENT
1
Entering edit mode
4 months ago

both with the same samples and variants.

Same samples and variants ? how about

comm \
     <(bcftools query -f '[%CHROM:%POS:%REF:%ALT:%SAMPLE:%GT\n]' file1.vcf| sort) \
     <(bcftools query -f '[%CHROM:%POS:%REF:%ALT:%SAMPLE:%GT\n]' file2.vcf| sort)
ADD COMMENT

Login before adding your answer.

Traffic: 3372 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6