htslib.bgzf

@file htslib/bgzf.h Low-level routines for direct BGZF operations.

Members

Aliases

bgzf_fdopen
alias bgzf_fdopen = bgzf_dopen
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
bgzidx_t
alias bgzidx_t = __bgzidx_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
ssize_t
alias ssize_t = int
Undocumented in source.
ssize_t
alias ssize_t = long
Undocumented in source.

Functions

bgzf_block_write
ssize_t bgzf_block_write(BGZF* fp, const(void)* data, size_t length)

Write _length_ bytes from _data_ to the file, the index will be used to decide the amount of uncompressed data to be written to each bgzip block. If no I/O errors occur, the complete _length_ bytes will be written (or queued for writing). @param fp BGZF file handler @param data data array to write @param length size of data to write @return number of bytes written (i.e., _length_); negative on error

bgzf_check_EOF
int bgzf_check_EOF(BGZF* fp)

Check if the BGZF end-of-file (EOF) marker is present

bgzf_close
int bgzf_close(BGZF* fp)

Close the BGZF and free all associated resources.

bgzf_compress
int bgzf_compress(void* dst, size_t* dlen, const(void)* src, size_t slen, int level)

Compress a single BGZF block.

bgzf_compression
int bgzf_compression(BGZF* fp)

Return the file's compression format

bgzf_dopen
BGZF* bgzf_dopen(int fd, const(char)* mode)

Open an existing file descriptor for reading or writing.

bgzf_flush
int bgzf_flush(BGZF* fp)

Write the data in the buffer to the file.

bgzf_flush_try
int bgzf_flush_try(BGZF* fp, ssize_t size)

Flush the file if the remaining buffer size is smaller than _size_ @return 0 if flushing succeeded or was not needed; negative on error

bgzf_getc
int bgzf_getc(BGZF* fp)

Read one byte from a BGZF file. It is faster than bgzf_read() @param fp BGZF file handler @return byte read; -1 on end-of-file or error

bgzf_getline
int bgzf_getline(BGZF* fp, int delim, kstring_t* str)

Read one line from a BGZF file. It is faster than bgzf_getc()

bgzf_hopen
BGZF* bgzf_hopen(hFILE* fp, const(char)* mode)

Open an existing hFILE stream for reading or writing.

bgzf_index_build_init
int bgzf_index_build_init(BGZF* fp)

Tell BGZF to build index while compressing.

bgzf_index_dump
int bgzf_index_dump(BGZF* fp, const(char)* bname, const(char)* suffix)

@param fp BGZF file handler @param bname base name @param suffix suffix to add to bname (can be NULL) @return 0 on success and -1 on error.

bgzf_index_dump_hfile
int bgzf_index_dump_hfile(BGZF* fp, hFILE* idx, const(char)* name)

@param fp BGZF file handle @param idx hFILE to write to @param name file name (for error reporting only, can be NULL) @return 0 on success and -1 on error.

bgzf_index_load
int bgzf_index_load(BGZF* fp, const(char)* bname, const(char)* suffix)

@param fp BGZF file handler @param bname base name @param suffix suffix to add to bname (can be NULL) @return 0 on success and -1 on error.

bgzf_index_load_hfile
int bgzf_index_load_hfile(BGZF* fp, hFILE* idx, const(char)* name)

@param fp BGZF file handle @param idx hFILE to read from @param name file name (for error reporting only; can be NULL) @return 0 on success and -1 on error.

bgzf_is_bgzf
int bgzf_is_bgzf(const(char)* fn)

Check if a file is in the BGZF format

bgzf_mt
int bgzf_mt(BGZF* fp, int n_threads, int n_sub_blks)

Enable multi-threading (only effective when the library was compiled with -DBGZF_MT)

bgzf_open
BGZF* bgzf_open(const(char)* path, const(char)* mode)

Open the specified file for reading or writing.

bgzf_peek
int bgzf_peek(BGZF* fp)

Returns the next byte in the file without consuming it. @param fp BGZF file handler @return -1 on EOF, -2 on error, otherwise the unsigned byte value.

bgzf_raw_read
ssize_t bgzf_raw_read(BGZF* fp, void* data, size_t length)

Read up to _length_ bytes directly from the underlying stream without decompressing. Bypasses BGZF blocking, so must be used with care in specialised circumstances only.

bgzf_raw_write
ssize_t bgzf_raw_write(BGZF* fp, const(void)* data, size_t length)

Write _length_ bytes directly to the underlying stream without compressing. Bypasses BGZF blocking, so must be used with care in specialised circumstances only.

bgzf_read
ssize_t bgzf_read(BGZF* fp, void* data, size_t length)

Read up to _length_ bytes from the file storing into _data_.

bgzf_read_block
int bgzf_read_block(BGZF* fp)

Read the next BGZF block.

bgzf_seek
long bgzf_seek(BGZF* fp, long pos, int whence)

Set the file to read from the location specified by _pos_.

bgzf_set_cache_size
void bgzf_set_cache_size(BGZF* fp, int size)

Set the cache size. Only effective when compiled with -DBGZF_CACHE.

bgzf_tell
auto bgzf_tell(T fp)

Return a virtual file pointer to the current location in the file. No interpretation of the value should be made, other than a subsequent call to bgzf_seek can be used to position the file at the same point. Return value is non-negative on success.

bgzf_thread_pool
int bgzf_thread_pool(BGZF* fp, hts_tpool* pool, int qsize)

Enable multi-threading (when compiled with -DBGZF_MT) via a shared thread pool. This means both encoder and decoder can balance usage across a single pool of worker jobs.

bgzf_useek
int bgzf_useek(BGZF* fp, off_t uoffset, int where)

Position BGZF at the uncompressed offset

bgzf_utell
off_t bgzf_utell(BGZF* fp)

Position in uncompressed BGZF

bgzf_write
ssize_t bgzf_write(BGZF* fp, const(void)* data, size_t length)

Write _length_ bytes from _data_ to the file. If no I/O errors occur, the complete _length_ bytes will be written (or queued for writing).

Manifest constants

BGZF_BLOCK_SIZE
enum BGZF_BLOCK_SIZE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_CRC
enum BGZF_ERR_CRC;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_HEADER
enum BGZF_ERR_HEADER;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_IO
enum BGZF_ERR_IO;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_MISUSE
enum BGZF_ERR_MISUSE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_MT
enum BGZF_ERR_MT;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_ERR_ZLIB
enum BGZF_ERR_ZLIB;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
BGZF_MAX_BLOCK_SIZE
enum BGZF_MAX_BLOCK_SIZE;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Structs

BGZF
struct BGZF
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
__bgzidx_t
struct __bgzidx_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
bgzf_cache_t
struct bgzf_cache_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
bgzf_mtaux_t
struct bgzf_mtaux_t
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
hts_tpool
struct hts_tpool
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
z_stream_s
struct z_stream_s
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Meta