-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecord.h
executable file
·88 lines (78 loc) · 2.13 KB
/
record.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef Record_H
#define Record_H
#include <string>
#include <cstdlib>
#include "common.h"
const int MAXLEN = 8 * MB;
enum StringField {
RN,
CHR,
CIGAR,
P_CHR,
SEQ,
QUAL,
OPT
};
enum IntField {
MF,
LOC,
MQ,
P_LOC,
TLEN
};
class Record {
char line[MAXLEN];
char *strFields[7];
int32_t intFields[5];
private:
friend class BAMParser;
friend class SAMParser;
public:
const char* getReadName() const { return strFields[RN]; }
const int getMappingFlag() const { return intFields[MF]; }
const char* getChromosome() const { return strFields[CHR]; }
const size_t getLocation() const { return intFields[LOC] - 1; }
const char getMappingQuality() const { return intFields[MQ]; }
const char* getCigar() const { return strFields[CIGAR]; }
const char* getPairChromosome() const { return strFields[P_CHR]; }
const size_t getPairLocation() const { return intFields[P_LOC] - 1; }
const int getTemplateLength() const { return intFields[TLEN]; }
const char* getSequence() const { return strFields[SEQ]; }
const char* getQuality() const { return strFields[QUAL]; }
const char* getOptional() const { return strFields[OPT]; }
std::string getFullRecord() const {
return S(
"%s %d %s %lu %d %s %s %lu %d %s %s p",
getReadName(),
getMappingFlag(),
getChromosome(),
getLocation(),
getMappingQuality(),
getCigar(),
getPairChromosome(),
getPairLocation(),
getTemplateLength(),
getSequence(),
getQuality(),
getOptional()
);
}
void testRecords() const {
LOG(
"%s %d %s %lu %d %s %s %lu %d %s %s %s\n",
getReadName(),
getMappingFlag(),
getChromosome(),
getLocation(),
getMappingQuality(),
getCigar(),
getPairChromosome(),
getPairLocation(),
getTemplateLength(),
getSequence(),
getQuality(),
getOptional()
);
}
};
#endif // RECORD_H