Tutorial: Merging multiple vcf files into Single vcf file
gravatar for jaybee
21 months ago by
South Korea
jaybee80 wrote:

To merge multiple vcf files into a single vcf file from different samples,

we can try the code below:

/PATH/to/bcftools merge Home/data/*vcf.gz -Oz -o Merged.vcf.gz

[considering that your files A.vcf.gz , B.vcf.gz and so on are in the Home directory, under the folder data]

[If your bcftools is installed in the usr/bin directory then simply use:

/usr/bin/bcftools merge Home/data/*vcf.gz -Oz -o Merged.vcf.gz

For selective merging:

one may create a list of selected vcf files using the command:

ls *.vcf.gz > vcfout.list

Then merge the selected files using the vcfout.list (file):

bcftools merge -m none --file-list vcfout.list -Oz -o ProjectMerge.vcf.gz

Courtesy: Pierre Lindenbaum, finswimmer, Kevin Blighe

This should work fine!

tutorial bcftools merge vcf • 1.7k views
ADD COMMENTlink modified 21 months ago • written 21 months ago by jaybee80

Just to add that this will merge any file in Home/data/ that has vcf.gz at the end of the filename. Using the method that I showed you elsewhere, jaybee, one can have a list (stored as single column in a file) of the specific files that they want to merge. Each has pros and cons.

ADD REPLYlink written 21 months ago by Kevin Blighe68k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1617 users visited in the last hour