1bgzip(1)                     Bioinformatics tools                     bgzip(1)
2
3
4

NAME

6       bgzip - Block compression/decompression utility
7

SYNOPSIS

9       bgzip   [-cdfhir]  [-b  virtualOffset]  [-I  index_name]  [-l  compres‐
10       sion_level] [-s size] [-@ threads] [file]
11

DESCRIPTION

13       Bgzip compresses files in a similar manner  to,  and  compatible  with,
14       gzip(1).  The file is compressed into a series of small (less than 64K)
15       'BGZF' blocks.  This allows indexes to be built against the  compressed
16       file and used to retrieve portions of the data without having to decom‐
17       press the entire file.
18
19       If no files are specified on the command line, bgzip will compress  (or
20       decompress if the -d option is used) standard input to standard output.
21       If a file is specified, it will be  compressed  (or  decompressed  with
22       -d).   If the -c option is used, the result will be written to standard
23       output, otherwise when compressing bgzip will write to a new file  with
24       a  .gz  suffix  and  remove the original.  When decompressing the input
25       file must have a .gz suffix, which will be removed to make  the  output
26       name.   Again  after decompression completes the input file will be re‐
27       moved.
28
29

OPTIONS

31       -b, --offset INT
32                 Decompress to standard  output  from  virtual  file  position
33                 (0-based uncompressed offset).  Implies -c and -d.
34
35       -c, --stdout
36                 Write to standard output, keep original files unchanged.
37
38       -d, --decompress
39                 Decompress.
40
41       -f, --force
42                 Overwrite  files  without  asking,  or  decompress files that
43                 don't have a known compression filename extension (e.g., .gz)
44                 without asking.  Use --force twice to do both without asking.
45
46       -h, --help
47                 Displays a help message.
48
49       -i, --index
50                 Create  a BGZF index while compressing.  Unless the -I option
51                 is used, this will have the name of the compressed file  with
52                 .gzi appended to it.
53
54       -I, --index-name FILE
55                 Index file name.
56
57       -l, --compress-level INT
58                 Compression  level  to use when compressing.  From 0 to 9, or
59                 -1 for the default level set by the compression library. [-1]
60
61       -r, --reindex
62                 Rebuild the index on an existing compressed file.
63
64       -g, --rebgzip
65                 Try to use an existing index to create a compressed file with
66                 matching block offsets.  Note that this assumes that the same
67                 compression library and level are in use as when  making  the
68                 original  file.  Don't use it unless you know what you're do‐
69                 ing.
70
71       -s, --size INT
72                 Decompress INT bytes (uncompressed size) to standard  output.
73                 Implies -c.
74
75       -@, --threads INT
76                 Number of threads to use [1].
77

BGZF FORMAT

79       The  BGZF format written by bgzip is described in the SAM format speci‐
80       fication available from http://samtools.github.io/hts-specs/SAMv1.pdf.
81
82       It makes use of a gzip feature which allows compressed files to be con‐
83       catenated.   The  input data is divided into blocks which are no larger
84       than 64 kilobytes both before and after compression (including compres‐
85       sion  headers).   Each  block is compressed into a gzip file.  The gzip
86       header includes an extra sub-field with identifier 'BC' and the  length
87       of the compressed block, including all headers.
88
89

GZI FORMAT

91       The  index  format is a binary file listing pairs of compressed and un‐
92       compressed offsets in a BGZF file.  Each compressed  offset  points  to
93       the  start of a BGZF block.  The uncompressed offset is the correspond‐
94       ing location in the uncompressed data stream.
95
96       All values are stored as little-endian 64-bit unsigned integers.
97
98       The file contents are:
99
100           uint64_t number_entries
101
102       followed by number_entries pairs of:
103
104           uint64_t compressed_offset
105           uint64_t uncompressed_offset
106
107
108

EXAMPLES

110           # Compress stdin to stdout
111           bgzip < /usr/share/dict/words > /tmp/words.gz
112
113           # Make a .gzi index
114           bgzip -r /tmp/words.gz
115
116           # Extract part of the data using the index
117           bgzip -b 367635 -s 4 /tmp/words.gz
118
119           # Uncompress the whole file, removing the compressed copy
120           bgzip -d /tmp/words.gz
121
122
123

AUTHOR

125       The BGZF library was originally implemented by Bob Handsaker and  modi‐
126       fied by Heng Li for remote file access and in-memory caching.
127
128

SEE ALSO

130       gzip(1), tabix(1)
131
132
133
134htslib-1.13                       7 July 2021                         bgzip(1)
Impressum