VCFTools vcf-merge not merging all files
1
0
Entering edit mode
7.4 years ago
zihan98li • 0

Hi All,

I am trying to use vcf-merge. However on my test batch of 6 files, only the first two merge.

vcf-merge ${all_gz_vcfs[*]} | bgzip -c > merged.vcf.gz

My suspicion is that since these VCF files came from three different modifications of ANNOVAR, vcf-merge is not working as intended. Would anybody have have insight towards a possible fix or has ran into this problem before?

Thank you,

Zihan

software error • 3.4k views
ADD COMMENT
0
Entering edit mode

what is the output of

echo  ${all_gz_vcfs[*]}

....

ADD REPLY
0
Entering edit mode

The output is my 6 files:

15232.clc.vcf.gz 15233.clc.vcf.gz 15416.vcf.gz 15417.vcf.gz 16198.vcf.gz 16200.vcf.gz

ADD REPLY
0
Entering edit mode

Hi Zihan!

How about

  • checking sample names - are they all different?
  • using bcftools merge
  • to remove all annotations, merge, and annotate then

Good luck!

Sergey

ADD REPLY
0
Entering edit mode

Hey Sergey,

I am new to this, could you elaborate a little more on your solutions, thank you!

ADD REPLY
3
Entering edit mode
7.4 years ago

Hi Zihan!

  • Switch to bcltools - it is faster, and (hopefully) has less bugs. bcftools

  • Check sample names in your vcf files:

    for f in *.gz;do echo $f; bcftools query -l $f;done;

If you are trying to create a multisample vcf file (to merge vcf files), and you have the same sample names in different vcf files you are merging, it is a problem. Sample names should be different.

To rename a sample, you can use bcftools again:

bcftools reheader -s file_with_new_sample_names.txt vcf.gz > renamed.vcf.gz

Another way to check sample names:

gunzip -c file.vcf.gz | grep CHROM
  • Remove annotations

If the source of the problem is not in identical sample names, but in the presence of annotation, then remove it before merging! The command depends on the annotator you are using. I'm using VEP which stores information in CSQ field. To remove, I'm using vt program :

vt rminfo annotated.vcf.gz -t CSQ -o naked.vcf.gz

Sergey

ADD COMMENT

Login before adding your answer.

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