Tutorial:Merging multiple vcf files into Single vcf file
0
0
Entering edit mode
2.2 years ago
jaybee ▴ 80

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!

vcf merge bcftools Tutorial • 2.5k views
ADD COMMENT
1
Entering edit mode

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 REPLY

Login before adding your answer.

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