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 private:
|
|
31 IntervalItem();
|
|
32
|
|
33 public:
|
|
34 int source_index; // which source BedGraph file this came from
|
|
35 COORDINATE_TYPE coord_type; // is this the start or the end position?
|
|
36 CHRPOS coord;
|
|
37 std::string depth;
|
|
38
|
|
39 IntervalItem(int _index, COORDINATE_TYPE _type, CHRPOS _coord, std::string _depth) :
|
|
40 source_index(_index),
|
|
41 coord_type(_type),
|
|
42 coord(_coord),
|
|
43 depth(_depth)
|
|
44 {}
|
|
45
|
|
46 IntervalItem(const IntervalItem &other) :
|
|
47 source_index(other.source_index),
|
|
48 coord_type(other.coord_type),
|
|
49 coord(other.coord),
|
|
50 depth(other.depth)
|
|
51 {}
|
|
52
|
|
53 bool operator< ( const IntervalItem& other ) const
|
|
54 {
|
|
55 return this->coord > other.coord;
|
|
56 }
|
|
57 };
|
|
58
|
|
59 // our priority queue
|
|
60 typedef std::priority_queue<IntervalItem> INTERVALS_PRIORITY_QUEUE;
|
|
61
|
|
62 #endif
|