Merging vcf files with bcftools ([E::get_intv] Failed to parse TBX_VCF, was wrong -p [type] used?)
1
0
Entering edit mode
18 days ago

Hello,

I am trying to using bcftools to combine 2 VCF files (in the folder there are the two .tbi files) with following command:

 bcftools merge -m snps -O v -o merged.vcf a.vcf.gz b.vcf.gz

but got these error :

[E::get_intv] Failed to parse TBX_VCF, was wrong -p [type] used? 
The offending line was: "##contig=<ID=2,length=242193529>" 
[E::get_intv] Failed to parse TBX_VCF, was wrong -p [type] used? 
The offending line was: "##contig=<ID=3,length=198295559>"
[E::get_intv] Failed to parse TBX_VCF, was wrong -p [type] used? 
The offending line was: "##contig=<ID=4,length=190214555>"

I don't know what this means and how to solve the problem. Can anybody help me? Thank you in advance.

vcf tabix bcftools • 307 views
ADD COMMENT
1
Entering edit mode
18 days ago

The vcf where indexed with tabix the wrong way. index your VCF using:

bcftools index -f a.vcf.gz
bcftools index -f b.vcf.gz
ADD COMMENT
0
Entering edit mode

Thank you! That was helpful, and I didn't encounter any issues with the command:

bcftools merge -m snps -O v -o merged.vcf a.vcf.gz b.vcf.gz

However, when merging two VCFs—one with 2000 SNPs and the other with 1200— I ended up with a merged VCF containing only 1100 SNPs. Ideally, I'd like to generate a VCF with 2000 SNPs or more, with all the variants in the two vcfs.

ADD REPLY
0
Entering edit mode

your command crashed or you have duplicates in your vcfs

ADD REPLY

Login before adding your answer.

Traffic: 2620 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