This is a test version of Biostars. For the public version, visit https://www.biostars.org.
VCFTools vcf-merge not merging all files

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

what is the output of

echo  ${all_gz_vcfs[*]}

....

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

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

Hey Sergey,

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

1 answer

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

Log in to answer this question.