Gamgee
You miserable little maggot. I'll stove your head in!
|
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <pthread.h>
#include <sys/types.h>
#include <inttypes.h>
#include "htslib/hts.h"
#include "htslib/bgzf.h"
#include "htslib/hfile.h"
#include "htslib/khash.h"
Classes | |
struct | cache_t |
struct | bgzidx1_t |
struct | __bgzidx_t |
struct | worker_t |
struct | bgzf_mtaux_t |
Macros | |
#define | BLOCK_HEADER_LENGTH 18 |
#define | BLOCK_FOOTER_LENGTH 8 |
Typedefs | |
typedef struct bgzf_mtaux_t | mtaux_t |
Functions | |
void | bgzf_index_destroy (BGZF *fp) |
int | bgzf_index_add_block (BGZF *fp) |
BGZF * | bgzf_open (const char *path, const char *mode) |
BGZF * | bgzf_dopen (int fd, const char *mode) |
BGZF * | bgzf_hopen (hFILE *hfp, const char *mode) |
int | bgzf_read_block (BGZF *fp) |
ssize_t | bgzf_read (BGZF *fp, void *data, size_t length) |
ssize_t | bgzf_raw_read (BGZF *fp, void *data, size_t length) |
int | bgzf_mt (BGZF *fp, int n_threads, int n_sub_blks) |
int | bgzf_flush (BGZF *fp) |
int | bgzf_flush_try (BGZF *fp, ssize_t size) |
ssize_t | bgzf_write (BGZF *fp, const void *data, size_t length) |
ssize_t | bgzf_raw_write (BGZF *fp, const void *data, size_t length) |
int | bgzf_close (BGZF *fp) |
void | bgzf_set_cache_size (BGZF *fp, int cache_size) |
int | bgzf_check_EOF (BGZF *fp) |
int64_t | bgzf_seek (BGZF *fp, int64_t pos, int where) |
int | bgzf_is_bgzf (const char *fn) |
int | bgzf_getc (BGZF *fp) |
int | bgzf_getline (BGZF *fp, int delim, kstring_t *str) |
int | bgzf_index_build_init (BGZF *fp) |
int | bgzf_index_dump (BGZF *fp, const char *bname, const char *suffix) |
int | bgzf_index_load (BGZF *fp, const char *bname, const char *suffix) |
int | bgzf_useek (BGZF *fp, long uoffset, int where) |
long | bgzf_utell (BGZF *fp) |
#define BLOCK_FOOTER_LENGTH 8 |
#define BLOCK_HEADER_LENGTH 18 |
typedef struct bgzf_mtaux_t mtaux_t |
int bgzf_check_EOF | ( | BGZF * | fp | ) |
int bgzf_close | ( | BGZF * | fp | ) |
BGZF* bgzf_dopen | ( | int | fd, |
const char * | mode | ||
) |
Open an existing file descriptor for reading or writing.
fd | file descriptor |
mode | mode matching /[rwag][u0-9]+/: 'r' for reading, 'w' for writing, 'a' for appending, 'g' for gzip rather than BGZF compression (with 'w' only), and digit specifies the zlib compression level. Note that there is a distinction between 'u' and '0': the first yields plain uncompressed output whereas the latter outputs uncompressed data wrapped in the zlib format. |
int bgzf_flush | ( | BGZF * | fp | ) |
Write the data in the buffer to the file.
int bgzf_flush_try | ( | BGZF * | fp, |
ssize_t | size | ||
) |
Flush the file if the remaining buffer size is smaller than size
int bgzf_getc | ( | BGZF * | fp | ) |
Read one byte from a BGZF file. It is faster than bgzf_read()
fp | BGZF file handler |
Read one line from a BGZF file. It is faster than bgzf_getc()
fp | BGZF file handler |
delim | delimitor |
str | string to write to; must be initialized |
Open an existing hFILE stream for reading or writing.
int bgzf_index_add_block | ( | BGZF * | fp | ) |
int bgzf_index_build_init | ( | BGZF * | fp | ) |
void bgzf_index_destroy | ( | BGZF * | fp | ) |
int bgzf_index_dump | ( | BGZF * | fp, |
const char * | bname, | ||
const char * | suffix | ||
) |
int bgzf_index_load | ( | BGZF * | fp, |
const char * | bname, | ||
const char * | suffix | ||
) |
int bgzf_is_bgzf | ( | const char * | fn | ) |
int bgzf_mt | ( | BGZF * | fp, |
int | n_threads, | ||
int | n_sub_blks | ||
) |
Enable multi-threading (only effective on writing and when the library was compiled with -DBGZF_MT)
fp | BGZF file handler; must be opened for writing |
n_threads | #threads used for writing |
n_sub_blks | #blocks processed by each thread; a value 64-256 is recommended |
BGZF* bgzf_open | ( | const char * | path, |
const char * | mode | ||
) |
Open the specified file for reading or writing.
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.
fp | BGZF file handler |
data | data array to read into |
length | number of raw bytes to read |
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.
fp | BGZF file handler |
data | data array to write |
length | number of raw bytes to write |
ssize_t bgzf_read | ( | BGZF * | fp, |
void * | data, | ||
size_t | length | ||
) |
Read up to length bytes from the file storing into data.
fp | BGZF file handler |
data | data array to read into |
length | size of data to read |
int64_t bgzf_seek | ( | BGZF * | fp, |
int64_t | pos, | ||
int | whence | ||
) |
Set the file to read from the location specified by pos.
fp | BGZF file handler |
pos | virtual file offset returned by bgzf_tell() |
whence | must be SEEK_SET |
void bgzf_set_cache_size | ( | BGZF * | fp, |
int | size | ||
) |
Set the cache size. Only effective when compiled with -DBGZF_CACHE.
fp | BGZF file handler |
size | size of cache in bytes; 0 to disable caching (default) |
int bgzf_useek | ( | BGZF * | fp, |
long | uoffset, | ||
int | where | ||
) |
long bgzf_utell | ( | BGZF * | fp | ) |
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).
fp | BGZF file handler |
data | data array to write |
length | size of data to write |