34 static const int16_t PAIRED = 0x0001;
35 static const int16_t PROPER_PAIR = 0x0002;
36 static const int16_t UNMAPPED = 0x0004;
37 static const int16_t MATE_UNMAPPED = 0x0008;
38 static const int16_t REVERSE = 0x0010;
39 static const int16_t MATE_REVERSED = 0x0020;
40 static const int16_t FIRST_READ = 0x0040;
41 static const int16_t SECOND_READ = 0x0080;
42 static const int16_t SECONDARY_ALIGNMENT = 0x0100;
43 static const int16_t FAILED_QUALITY = 0x0200;
44 static const int16_t DUPLICATE = 0x0400;
45 static const int16_t SUPPLEMENTARY_ALIGNMENT = 0x0800;
46 static const int16_t FRAGMENT_INFO = 0x00C0;
47 static const int16_t FRAGMENT_SHIFT = 6;
53 static inline bool isMapped(uint16_t flag) {
return(!(flag & UNMAPPED));}
54 static inline bool isMateMapped(uint16_t flag) {
return(!(flag & MATE_UNMAPPED));}
56 static inline bool isPaired(uint16_t flag) {
return(flag & PAIRED);}
57 static inline bool isReverse(uint16_t flag) {
return(flag & REVERSE);}
58 static inline bool isMateReverse(uint16_t flag) {
return(flag & MATE_REVERSED);}
59 static inline bool isProperPair(uint16_t flag)
62 return(isPaired(flag) && (flag & PROPER_PAIR));
64 static inline bool isDuplicate(uint16_t flag) {
return(flag & DUPLICATE);}
65 static inline bool isQCFailure(uint16_t flag) {
return(flag & FAILED_QUALITY);}
67 static inline bool isSecondary(uint16_t flag) {
return(flag & SECONDARY_ALIGNMENT);}
74 return((flag & FIRST_READ) && !(flag & SECOND_READ));
81 return(!(flag & FIRST_READ) && (flag & SECOND_READ));
88 return((flag & FIRST_READ) && (flag & SECOND_READ));
95 return(!(flag & FIRST_READ) && !(flag & SECOND_READ));
98 static inline uint8_t getFragmentType(uint16_t flag)
100 return((flag & FRAGMENT_INFO) >> FRAGMENT_SHIFT);
104 static inline void setUnmapped(uint16_t& flag) { flag |= UNMAPPED;}
Class for extracting information from a SAM Flag.
static void setNotDuplicate(uint16_t &flag)
Mark the passed in flag as not duplicate.
static bool isUnknownFragment(uint16_t flag)
Return if it is an unknown fragment fragment or not (if FIRST_READ is not set and SECOND_READ is also...
static bool isLastFragment(uint16_t flag)
Return if it is the last fragment or not (if FIRST_READ is not set and SECOND_READ is).
static void setDuplicate(uint16_t &flag)
Mark the passed in flag as not duplicate.
static bool isFirstFragment(uint16_t flag)
Return if it is the first fragment or not (if FIRST_READ is set and SECOND_READ is not).
static bool isMidFragment(uint16_t flag)
Return if it is a middle fragment or not (if FIRST_READ is set and SECOND_READ is also set).
static void setUnmapped(uint16_t &flag)
Mark the passed in flag as unmapped.