0
|
1 /*****************************************************************************
|
|
2 intervalItem.h
|
|
3
|
|
4 (c) 2010 - Assaf Gordon
|
|
5 Hall Laboratory
|
|
6 Department of Biochemistry and Molecular Genetics
|
|
7 University of Virginia
|
|
8 aaronquinlan@gmail.com
|
|
9
|
|
10 Licenced under the GNU General Public License 2.0 license.
|
|
11 ******************************************************************************/
|
|
12 #ifndef INTERVALITEM_H
|
|
13 #define INTERVALITEM_H
|
|
14
|
|
15 #include <string>
|
|
16 #include <queue>
|
|
17
|
|
18 enum COORDINATE_TYPE {
|
|
19 START,
|
|
20 END
|
|
21 };
|
|
22
|
|
23 /*
|
|
24 An interval item in the priority queue.
|
|
25
|
|
26 An IntervalItem can mark either a START position or an END position.
|
|
27 */
|
|
28 class IntervalItem
|
|
29 {
|
|
30
|
|
31
|
|
32 public:
|
|
33 int source_index; // which source BedGraph file this came from
|
|
34 COORDINATE_TYPE coord_type; // is this the start or the end position?
|
|
35 CHRPOS coord;
|
|
36
|
|
37 IntervalItem () :
|
|
38 source_index(-1),
|
|
39 coord_type(START),
|
|
40 coord(0)
|
|
41 {}
|
|
42
|
|
43 IntervalItem(int _index, COORDINATE_TYPE _type, CHRPOS _coord) :
|
|
44 source_index(_index),
|
|
45 coord_type(_type),
|
|
46 coord(_coord)
|
|
47 {}
|
|
48
|
|
49 IntervalItem(const IntervalItem &other) :
|
|
50 source_index(other.source_index),
|
|
51 coord_type(other.coord_type),
|
|
52 coord(other.coord)
|
|
53 {}
|
|
54
|
|
55 bool operator< ( const IntervalItem& other ) const
|
|
56 {
|
|
57 return this->coord > other.coord;
|
|
58 }
|
|
59 };
|
|
60
|
|
61 // our priority queue
|
|
62 typedef std::priority_queue<IntervalItem> INTERVALS_PRIORITY_QUEUE;
|
|
63
|
|
64 #endif
|