This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Grepping samples out of vcf and writing them to a new file

I am trying to select samples from a bigger vcf file and write the subset into a new vcf.gz file. The first part works well, meaning getting the samples out of the initial file. ( bcftools view initial_vcf.vcf.gz --force-samples -s samp1,samp2 )

When I try to write the new file though, I end up with a 0 bytes fcf.gz file ("unexpected end of file"). I've tried formats like this:

bcftools view initial_vcf.vcf.gz --force-samples -S selected_samples.txt | bgzip -c >  new_vcf.vcf.gz

and versions of

bcftools view initial_vcf.vcf.gz --force-samples -S selected_samples.txt -Oz -o new_vcf.vcf.gz

Any help/suggestion greatly appreciated.

vcf grep bgzip bcftools

Hi Pierre, no error message, it just never finishes.

what is the filesystem ? what is your OS ? "it just never finishes" is contradictory with " I end up with a 0 bytes fcf.gz file" ? what is the size of the initial_vcf.vcf.gz ?

Sorry for the lack of details, I am running it on our Linux server and the original file sizes are around 70GB. And you are right, the claims are a bit contradictory, I can see a file created but nothing is written into it (thus, 0 bytes); the process never terminates though.

the process never terminates though.

70G is high. how long did you wait ?

Several hours, restarted a few hours ago, ps -u username shows me

02:46:37 bcftools
00:00:03 bgzip

0 answers

No answers yet.

Log in to answer this question.