Imported Upstream version 0.12.7
[bowtie.git] / range.h
1 /**
2  * range.h
3  */
4
5 #ifndef RANGE_H_
6 #define RANGE_H_
7
8 #include <vector>
9 #include <stdint.h>
10
11 /**
12  * A range along with the alignment it represents.
13  */
14 struct Range {
15         Range() :
16                 top(0xffffffff), bot(0), cost(0), stratum(0), numMms(0),
17                 fw(true), mate1(true), ebwt(NULL)
18         {
19                 mms.clear();
20                 refcs.clear();
21         }
22
23         bool valid() const {
24                 return top < 0xffffffff;
25         }
26
27         void invalidate() {
28                 top = 0xffffffff;
29         }
30
31         uint32_t top;     // top of range
32         uint32_t bot;     // bottom of range
33         uint16_t cost;    // cost
34         uint32_t stratum; // stratum
35         uint32_t numMms;  // # mismatches
36         bool fw;          // the forward orientation of read aligned?
37         bool mate1;       // read aligned is #1 mate/single?
38         std::vector<uint32_t> mms;   // list of positions with mismatches
39         std::vector<uint8_t>  refcs; // reference characters at mismatch positions
40         const Ebwt<seqan::String<seqan::Dna> > *ebwt;
41
42         bool repOk() const {
43                 assert_eq(refcs.size(), mms.size());
44                 assert_eq(numMms, mms.size());
45                 assert_leq(stratum, numMms);
46                 return true;
47         }
48 };
49
50 #endif /* RANGE_H_ */