-
Notifications
You must be signed in to change notification settings - Fork 296
Expand file tree
/
Copy pathBamAux.h
More file actions
72 lines (62 loc) · 1.67 KB
/
BamAux.h
File metadata and controls
72 lines (62 loc) · 1.67 KB
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
#include <string>
#include <stdint.h>
#ifndef BAMAUX_H
#define BAMAUX_H
namespace BamTools {
struct RefData
{
std::string RefName; //!< name of reference sequence
int32_t RefLength; //!< length of reference sequence
//! constructor
RefData(const std::string& name = std::string(), const int32_t& length = 0)
: RefName(name)
, RefLength(length)
{}
};
struct BamRegion
{
int LeftRefID; //!< reference ID for region's left boundary
int LeftPosition; //!< position for region's left boundary
int RightRefID; //!< reference ID for region's right boundary
int RightPosition; //!< position for region's right boundary
//! constructor
BamRegion(const int& leftID = -1, const int& leftPos = -1, const int& rightID = -1,
const int& rightPos = -1)
: LeftRefID(leftID)
, LeftPosition(leftPos)
, RightRefID(rightID)
, RightPosition(rightPos)
{}
//! copy constructor
BamRegion(const BamRegion& other)
: LeftRefID(other.LeftRefID)
, LeftPosition(other.LeftPosition)
, RightRefID(other.RightRefID)
, RightPosition(other.RightPosition)
{}
//! Clears region boundaries
void clear()
{
LeftRefID = -1;
LeftPosition = -1;
RightRefID = -1;
RightPosition = -1;
}
//! Returns true if region has a left boundary
bool isLeftBoundSpecified() const
{
return (LeftRefID >= 0 && LeftPosition >= 0);
}
//! Returns true if region boundaries are not defined
bool isNull() const
{
return (!isLeftBoundSpecified() && !isRightBoundSpecified());
}
//! Returns true if region has a right boundary
bool isRightBoundSpecified() const
{
return (RightRefID >= 0 && RightPosition >= 1);
}
};
}
#endif