Question: (Closed) Merge selective vcf files into one vcf file using a single command
gravatar for jaybee
4 weeks ago by
South Korea
jaybee10 wrote:


I have a directory named "set" where I have 4 sets namely set1, set2, set3, and set4. Each set has 50 Indel vcf files and 50 SNP vcf files. The files are vcf.gz format along with their index files, .vcf.gz.tbi.

In each set, for Indel as well as for SNP, I created a list for only the vcf files (before creating their respective index files) using

for i in *.vcf.gz;
do ls > vcfindel1.list

[vcfindel1.list is the list of vcf files of the indels in set 1 ONLY]

It creates a list file for every indel and SNP for each set.

Now, I use merge command to merge all 50 vcf files into One vcf file using:

command="bcftools merge -Ob -m none " ;

while read vcfindel1
    command="${command}"" ""${vcfindel1}" ;
done < vcfindel1.list

command="${command}"" -o ProjectMerge.bcf" ;

echo `$command` ;

bcftools index ProjectMerge.bcf ;

But, I receive the error message:

vcfindel1.list unknown file type

Anybody can help me solve this?

bcftools wes merge vcf • 104 views
ADD COMMENTlink modified 4 weeks ago by Pierre Lindenbaum118k • written 4 weeks ago by jaybee10

Hello jaybee!

We believe that this post does not fit the main topic of this site.

I closed this post as I have received the solution of my question.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.


ADD REPLYlink written 15 days ago by jaybee10
gravatar for Pierre Lindenbaum
4 weeks ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum118k wrote:


for i in *.vcf.gz;
do ls > vcfindel1.list


ls *.vcf.gz > vcfindel1.list


find . -type f -name "*.vcf.gz" > vcfindel1.list

Then use simply something like:

bctools merge -m none --file-list   vcfindel1.list -O z -o out.vcf.gz
ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by Pierre Lindenbaum118k

Woah! It works !! Thank you! :)

ADD REPLYlink written 4 weeks ago by jaybee10
Please log in to add an answer.
The thread is closed. No new answers may be added.


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