Tutorial: Merging multiple vcf files into Single vcf file
0
gravatar for jaybee
6 months ago by
jaybee40
South Korea
jaybee40 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 • 483 views
ADD COMMENTlink modified 6 months ago • written 6 months ago by jaybee40
1

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 6 months ago by Kevin Blighe46k
Please log in to add an answer.

Help
Access

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