10 int len; // len is the unit length
12 // derived info: fmt, len
19 char *str, *ref, *alt, *flt, *info, *fmt; // fmt, ref, alt and info point to str
23 // derived info: ref, alt, flt, info, fmt, n_gi, n_alleles
27 int32_t n_ref, n_smpl;
31 char *name, *sname, *txt;
33 // derived info: n_ref, n_smpl, ns, sns
43 typedef struct __bcf_idx_t bcf_idx_t;
49 bcf_t *bcf_open(const char *fn, const char *mode);
50 int bcf_close(bcf_t *b);
51 int bcf_read(bcf_t *bp, const bcf_hdr_t *h, bcf1_t *b);
52 int bcf_sync(int n_smpl, bcf1_t *b);
53 int bcf_write(bcf_t *bp, const bcf_hdr_t *h, const bcf1_t *b);
54 bcf_hdr_t *bcf_hdr_read(bcf_t *b);
55 int bcf_hdr_write(bcf_t *b, const bcf_hdr_t *h);
56 int bcf_hdr_sync(bcf_hdr_t *b);
57 void bcf_hdr_destroy(bcf_hdr_t *h);
58 int bcf_destroy(bcf1_t *b);
59 char *bcf_fmt(const bcf_hdr_t *h, bcf1_t *b);
61 bcf_t *vcf_open(const char *fn, const char *mode);
62 int vcf_close(bcf_t *bp);
63 bcf_hdr_t *vcf_hdr_read(bcf_t *bp);
64 int vcf_hdr_write(bcf_t *bp, const bcf_hdr_t *h);
65 int vcf_write(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b);
66 int vcf_read(bcf_t *bp, bcf_hdr_t *h, bcf1_t *b);
68 int bcf_shrink_alt(int n_smpl, bcf1_t *b, int n);
69 void *bcf_build_refhash(bcf_hdr_t *h);
70 void bcf_str2id_destroy(void *_hash);
71 int bcf_str2id_add(void *_hash, const char *str);
72 int bcf_str2id(void *_hash, const char *str);
73 void *bcf_str2id_init();
75 int bcf_idx_build(const char *fn);
76 uint64_t bcf_idx_query(const bcf_idx_t *idx, int tid, int beg, int end);
77 int bcf_parse_region(void *str2id, const char *str, int *tid, int *begin, int *end);
78 bcf_idx_t *bcf_idx_load(const char *fn);
79 void bcf_idx_destroy(bcf_idx_t *idx);
85 static inline uint32_t bcf_str2int(const char *str, int l)
89 for (i = 0; i < l && i < 4; ++i) {
90 if (str[i] == 0) return x;