]> git.donarmstrong.com Git - samtools.git/blob - bcf.h
Generate binary VCF
[samtools.git] / bcf.h
1 #ifndef BCF_H
2 #define BCF_H
3
4 #include <stdint.h>
5 #include "bgzf.h"
6
7 typedef struct {
8         int fmt, len; // len is the unit length
9         void *data;
10         // derived info: fmt, len
11 } bcf_ginfo_t;
12
13 typedef struct {
14         int32_t tid, pos;
15         uint32_t qual:8, l_str:24;
16         int m_str;
17         char *str, *ref, *alt, *flt, *info, *fmt; // fmt, ref, alt and info point to str
18         int n_gi, m_gi;
19         bcf_ginfo_t *gi;
20         int n_alleles;
21         // derived info: ref, alt, flt, info, fmt, n_gi, n_alleles
22 } bcf1_t;
23
24 typedef struct {
25         int32_t n_ref, n_smpl;
26         int32_t l_nm;
27         int32_t l_smpl;
28         int32_t l_txt;
29         char *name, *sname, *txt;
30         char **ns, **sns;
31         // derived info: n_ref, n_smpl, ns, sns
32 } bcf_hdr_t;
33
34 typedef struct {
35         BGZF *fp;
36         bcf_hdr_t h;
37 } bcf_t;
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43         bcf_t *bcf_open(const char *fn, const char *mode);
44         int bcf_close(bcf_t *b);
45         int bcf_read(bcf_t *bp, bcf1_t *b);
46         int bcf_sync(int n_smpl, bcf1_t *b);
47         int bcf_write(bcf_t *bp, const bcf1_t *b);
48         int bcf_hdr_write(bcf_t *b);
49         int bcf_hdr_sync(bcf_hdr_t *b);
50         int bcf_destroy(bcf1_t *b);
51         char *bcf_fmt(bcf_t *bp, bcf1_t *b);
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif