1 #include <string> 2 #include <stdlib.h> 3 #include <sys/stat.h> 4 #include "htslib/bgzf.h" 5 #include "htslib/tbx.h" 6 #include "htslib/kseq.h" 7 #include <iostream> 8 #include <cstring> 9 #include <vector> 10 11 12 using namespace std; 13 14 class Tabix { 15 16 htsFile* fn; 17 tbx_t* tbx; 18 kstring_t str; 19 hts_itr_t* iter; 20 const tbx_conf_t *idxconf; 21 int tid, beg, end; 22 string firstline; 23 bool has_jumped; 24 vector<string>::iterator current_chrom; 25 26 public: 27 string filename; 28 vector<string> chroms; 29 30 Tabix(void); 31 Tabix(string& file); 32 ~Tabix(void); 33 34 const kstring_t * getKstringPtr(); 35 void getHeader(string& header); 36 bool setRegion(string& region); 37 bool getNextLine(string& line); 38 bool getNextLineKS(); 39 40 }; 41