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.
• 120 views