<p>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.</p>

<p>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.</p>

<pre><code>[~]# bcftools index 

About:   Index bgzip compressed VCF/BCF files for random access.
Usage:   bcftools index [options] &lt;in.bcf&gt;|&lt;in.vcf.gz&gt;
</code></pre>

CC BY-SA 3.0
2017-11-21T08:24:12.283Z
Thanks! So I guess ```bgzip genotypes.vcf``` = ```bcftools view -Oz genotypes.vcf```, yeah?
heathobrien
CC BY-SA 3.0
2017-11-20T21:43:00.983Z
2017-11-21T15:39:27.753Z
2017-11-21T15:39:27.753Z
Bioathlete
<p>Yes. I haven't found it documented anywhere, but I ran a simple test:</p>

<pre><code>$ bcftools view -Oz --no-version foo.vcf &gt; 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
</code></pre>

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

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

CC BY-SA 3.0
2017-11-21T16:58:02.323Z
Nice. Can't really argue with that.
heathobrien
CC BY-SA 3.0
2017-11-21T15:11:33.213Z
2017-11-21T15:11:33.213Z
terdon
<p>I've got what seems like it should be a simple question, but I can't seem to figure it out from google. <a href="http://www.htslib.org/doc/bcftools.html#common_options" rel="noreferrer">bcftools</a> has 4 output options:</p>

<pre><code>Output compressed BCF (b), uncompressed BCF (u), compressed VCF (z), uncompressed VCF (v).
</code></pre>

<p>Are any of these the same as the output from <a href="http://www.htslib.org/doc/tabix.html" rel="noreferrer">bgzip</a>? </p>

<file-formats><vcf><htslib>
bcftools output vs. bgzip
# bcftools output vs. bgzip

(Asked by: username_0 on 2017-11-20)

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?

**Tags:** file-formats, vcf, htslib

---

## 2 answers

### Answer by username_2 on 2017-11-21. Score: 5 | Accepted answer

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.

> **Comments:**
> **username_0**: Nice. Can't really argue with that.  

---

### Answer by username_1 on 2017-11-20. Score: 2

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] |

> **Comments:**
> **username_0**: Thanks! So I guess ```bgzip genotypes.vcf``` = ```bcftools view -Oz genotypes.vcf```, yeah?  

---

