-
Notifications
You must be signed in to change notification settings - Fork 5
/
sga_bwt_reader.h
54 lines (46 loc) · 1.05 KB
/
sga_bwt_reader.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
//-----------------------------------------------
// Copyright 2010 Wellcome Trust Sanger Institute
// Written by Jared Simpson (js18@sanger.ac.uk)
// Released under the GPL
//-----------------------------------------------
//
// SGABWTReader - read sga's bwt file
//
#ifndef SGABWTREADER_H
#define SGABWTREADER_H
#include <fstream>
#include "sga_rlunit.h"
// State enum to track what segment of the
// BWT file is being parsed
enum BWIOStage
{
IOS_NONE,
IOS_HEADER,
IOS_BWSTR,
IOS_PC,
IOS_OCC,
IOS_DONE
};
//
enum BWFlag
{
BWF_NOFMI = 0,
BWF_HASFMI
};
// Magic number that the sga file starts with
const uint16_t RLBWT_FILE_MAGIC = 0xCACA;
class SGABWTReader
{
public:
SGABWTReader(const std::string& filename);
~SGABWTReader();
void readHeader(size_t& num_strings, size_t& num_symbols, BWFlag& flag);
char readChar();
private:
BWIOStage m_stage;
std::ifstream* m_pReader;
RLUnit m_currRun;
size_t m_numRunsOnDisk;
size_t m_numRunsRead;
};
#endif