-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathfastareader.h
72 lines (57 loc) · 1.19 KB
/
fastareader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef FASTA_READER_H
#define FASTA_READER_H
// includes
#include <cctype>
#include <clocale>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <stdexcept>
#include <string>
#include <map>
#include "zlib/zlib.h"
using namespace std;
class FastaReader
{
public:
FastaReader(string fastaFile, bool forceUpperCase = true);
~FastaReader();
bool hasNext();
void readNext();
void readAll();
inline string currentID()
{
return mCurrentID;
}
inline string currentDescription()
{
return mCurrentDescription;
}
inline string currentSequence()
{
return mCurrentSequence;
}
inline map<string, string>& contigs() {
return mAllContigs;
}
static bool test();
public:
string mCurrentSequence;
string mCurrentID ;
string mCurrentDescription;
map<string, string> mAllContigs;
private:
bool readLine();
bool endOfLine(char c);
void setFastaSequenceIdDescription();
bool getLine(char* line, int maxLine);
bool getChar(char& c);
bool eof();
private:
string mFilename;
bool mForceUpperCase;
gzFile mZipFile;
ifstream mFile;
bool mZipped;
};
#endif