| 1 |
/* |
| 2 |
* This is a C++ wrapper around tabix project which abstracts some of the details of opening and jumping in tabix-indexed files. |
| 3 |
* Author: Erik Garrison [email protected] |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef _TABIX_HPP |
| 7 |
#define _TABIX_HPP |
| 8 |
|
| 9 |
#include <string> |
| 10 |
#include <stdlib.h> |
| 11 |
#include <sys/stat.h> |
| •12 |
#include <htslib/bgzf.h> |
| 13 |
#include <htslib/tbx.h> |
| 14 |
#include <htslib/kseq.h> |
| 15 |
#include <iostream> |
| •16 |
#include <cstring> |
| 17 |
#include <vector> |
| 18 |
|
| 19 |
|
| 20 |
using namespace std; |
| 21 |
|
| 22 |
class Tabix { |
| 23 |
|
| •24 |
htsFile* fn; |
| 25 |
tbx_t* tbx; |
| 26 |
hts_itr_t* iter; |
| 27 |
const tbx_conf_t *idxconf; |
| 28 |
int tid, beg, end; |
| 29 |
string firstline; |
| •30 |
bool has_jumped; |
| 31 |
vector<string>::iterator current_chrom; |
| 32 |
|
| 33 |
public: |
| 34 |
|
| 35 |
string filename; |
| •36 |
vector<string> chroms; |
| 37 |
|
| 38 |
Tabix(void); |
| 39 |
Tabix(string& file); |
| 40 |
~Tabix(void); |
| 41 |
|
| 42 |
void getHeader(string& header); |
| 43 |
void getLastHeader(string & header); |
| 44 |
bool setRegion(string region); |
| 45 |
bool getNextLine(string& line); |
| •46 |
|
| 47 |
}; |
| 48 |
|
| 49 |
#endif |