5
$\begingroup$

I've got what seems like it should be a simple question, but I can't seem to figure it out from google. bcftools has 4 output options:

Output compressed BCF (b), uncompressed BCF (u), compressed VCF (z), uncompressed VCF (v).

Are any of these the same as the output from bgzip?

$\endgroup$

2 Answers 2

5
$\begingroup$

Yes. I haven't found it documented anywhere, but I ran a simple test:

$ bcftools view -Oz --no-version foo.vcf > bar.vcf.gz 
$ md5sum bar.vcf.gz 
18a2f494710cf170ba79892936015ba8  bar.vcf.gz

$ gunzip bar.vcf.gz 
$ bgzip bar.vcf 
$ md5sum bar.vcf.gz 
18a2f494710cf170ba79892936015ba8  bar.vcf.gz

$ gunzip bar.vcf.gz 
$ gzip bar.vcf 
$ md5sum bar.vcf.gz 
9f5b1cf654966912b78a9cb7175ffc2c  bar.vcf.gz

I passed a vcf file through bcftools view -Oz, checked the md5sum of the resulting file, then uncompressed it and recompressed with bgzip and confirmed that the resulting file had the same md5sum. Finally, I also compressed using normal gzip to be sure that the md5sum would be different, as it was.

So yes, it does indeed look like bcftools creates files that are the same as though you'd passed them through bgzip.

$\endgroup$
1
  • $\begingroup$ Nice. Can't really argue with that. $\endgroup$ Nov 21, 2017 at 16:58
2
$\begingroup$

Yes the compressed outputs should be the same format as bgzip. bcftools also has an option to index in either the CSI or TBI formats.

The index function mentions that it indexes bgzip compressed files. So one can assume that it also creates files using the bgzip compression. Also all the pipelines that I have built use bgzip and bcftools.

[~]# bcftools index 

About:   Index bgzip compressed VCF/BCF files for random access.
Usage:   bcftools index [options] <in.bcf>|<in.vcf.gz>
$\endgroup$
1
  • $\begingroup$ Thanks! So I guess bgzip genotypes.vcf = bcftools view -Oz genotypes.vcf, yeah? $\endgroup$ Nov 21, 2017 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.