| 1 |
#ifndef SEQLIB_FASTQ_READER_H |
| 2 |
#define SEQLIB_FASTQ_READER_H |
| 3 |
|
| 4 |
#include <string> |
| 5 |
|
| 6 |
#include <iostream> |
| 7 |
#include <fstream> |
| 8 |
#include <sys/stat.h> |
| 9 |
#include <unistd.h> |
| 10 |
|
| 11 |
|
| 12 |
#include "SeqLib/UnalignedSequence.h" |
| 13 |
|
| 14 |
namespace SeqLib{ |
| 15 |
|
| 16 |
|
| 17 |
class FastqReader { |
| 18 |
|
| 19 |
public: |
| 20 |
|
| 21 |
|
| 22 |
FastqReader() { |
| 23 |
seq = NULL; |
| 24 |
fp = NULL; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
FastqReader(const std::string& file); |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
bool Open(const std::string& file); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
bool GetNextSequence(UnalignedSequence& s); |
| 42 |
|
| 43 |
~FastqReader() { |
| 44 |
if (seq) |
| 45 |
kseq_destroy(seq); |
| 46 |
if (fp) |
| 47 |
gzclose(fp); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
private: |
| 52 |
|
| 53 |
std::string m_file; |
| 54 |
|
| 55 |
gzFile fp; |
| 56 |
kseq_t * seq; |
| 57 |
|
| 58 |
}; |
| 59 |
|
| 60 |
} |
| 61 |
|
| 62 |
#endif |