| 1 |
|
| #include <string> |
| 2 |
|
| #include <vector> |
| 3 |
|
| #include <sparsehash/dense_hash_map> |
| 4 |
|
| |
| 5 |
|
| class annot { |
| 6 |
|
| public: |
| 7 |
|
| int beg; |
| 8 |
|
| int end; |
| 9 |
|
| std::vector<long> pos; |
| 10 |
|
| }; |
| 11 |
|
| |
| 12 |
|
| class tidx { |
| 13 |
|
| FILE *fh; |
| 14 |
|
| void init(); |
| 15 |
|
| public: |
| 16 |
|
| bool debug; |
| 17 |
|
| tidx() {init();}; |
| 18 |
0 |
▶ | tidx(const char *path) {init(); read(path);}; |
Branch: 3 branches
| Branch | True | False | Total |
| tidx(const char *path) {init(); read(path);}; |
0 |
0 |
0 |
| tidx(const char *path) {init(); read(path);}; |
0 |
0 |
0 |
| tidx(const char *path) {init(); read(path);}; |
0 |
0 |
0 |
|
| 19 |
|
| |
| 20 |
|
| std::string path; |
| 21 |
|
| google::dense_hash_map<std::string,std::vector<annot> > map; |
| 22 |
|
| |
| 23 |
|
| void dump(FILE *stream); |
| 24 |
|
| bool read(const char *path); |
| 25 |
|
| void build(const char *path, const char *sep, int nchr, int nbeg, int nend, int skip_i, char skip_c, bool sub_e); |
| 26 |
|
| |
| 27 |
|
| const std::vector <long int> & lookup(const char *chr, int pos); |
| 28 |
|
| std::string lookup(const char *chr, int pos, const char *msep); |
| 29 |
|
| |
| 30 |
|
| // range lookup |
| 31 |
|
| std::vector <long int> lookup_r(const char *chr, int beg, int end); |
| 32 |
|
| std::string lookup_r(const char *chr, int beg, int end, const char *msep); |
| 33 |
|
| |
| 34 |
|
| // const char * return value |
| 35 |
|
| const char * lookup_c(const char *chr, int pos, const char *msep); |
| 36 |
|
| const char * lookup_cr(const char *chr, int beg, int end, const char *msep); |
| 37 |
|
| }; |
| 38 |
|
| |
| 39 |
|
| void chomp_line(struct line &l); |
| 40 |
|
| |
| 41 |
|
| // build, with no return value, for API use |
| 42 |
|
| void tidx_build(const char *path, const char *sep, int nchr, int nbeg, int nend, int skip_i, char skip_c, bool sub_e); |
| 43 |
|
| |