Imported Upstream version 0.1.1
[tabix.git] / tabix.h
1 #ifndef __TABIDX_H
2 #define __TABIDX_H
3
4 #include <stdint.h>
5 #include "kstring.h"
6 #include "bgzf.h"
7
8 #define TI_PRESET_GENERIC 0
9 #define TI_PRESET_SAM     1
10 #define TI_PRESET_VCF     2
11
12 #define TI_FLAG_UCSC      0x10000
13
14 typedef int (*ti_fetch_f)(int l, const char *s, void *data);
15
16 struct __ti_index_t;
17 typedef struct __ti_index_t ti_index_t;
18
19 typedef struct {
20         int32_t preset;
21         int32_t sc, bc, ec;
22         int32_t meta_char, line_skip;
23 } ti_conf_t;
24
25 extern ti_conf_t ti_conf_gff, ti_conf_bed, ti_conf_psltbl, ti_conf_vcf, ti_conf_sam;
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31         int ti_readline(BGZF *fp, kstring_t *str);
32
33         int ti_index_build(const char *fn, const ti_conf_t *conf);
34         ti_index_t *ti_index_load(const char *fn);
35         void ti_index_destroy(ti_index_t *idx);
36         int ti_parse_region(ti_index_t *idx, const char *str, int *tid, int *begin, int *end);
37         int ti_fetch(BGZF *fp, const ti_index_t *idx, int tid, int beg, int end, void *data, ti_fetch_f func);
38
39 #ifdef __cplusplus
40 }
41 #endif
42
43 #endif