SamFlag.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __SAM_FLAG_H__
00019 #define __SAM_FLAG_H__
00020
00021 #include <stdint.h>
00022
00023
00024 class SamFlag
00025 {
00026 public:
00027
00028 static const int16_t PAIRED = 0x0001;
00029 static const int16_t PROPER_PAIR = 0x0002;
00030 static const int16_t UNMAPPED = 0x0004;
00031 static const int16_t MATE_UNMAPPED = 0x0008;
00032 static const int16_t REVERSE = 0x0010;
00033 static const int16_t MATE_REVERSED = 0x0020;
00034 static const int16_t FIRST_READ = 0x0040;
00035 static const int16_t SECOND_READ = 0x0080;
00036 static const int16_t SECONDARY_ALIGNMENT = 0x0100;
00037 static const int16_t FAILED_QUALITY = 0x0200;
00038 static const int16_t DUPLICATE = 0x0400;
00039
00040 static const int16_t FRAGMENT_INFO = 0x00C0;
00041 static const int16_t FRAGMENT_SHIFT = 6;
00042
00043 static inline bool isMapped(uint16_t flag) {return(!(flag & UNMAPPED));}
00044 static inline bool isPaired(uint16_t flag) {return(flag & PAIRED);}
00045 static inline bool isReverse(uint16_t flag) {return(flag & REVERSE);}
00046 static inline bool isProperPair(uint16_t flag) {return(flag & PROPER_PAIR);}
00047 static inline bool isDuplicate(uint16_t flag) {return(flag & DUPLICATE);}
00048 static inline bool isQCFailure(uint16_t flag) {return(flag & FAILED_QUALITY);}
00049 static inline bool isFirstFragment(uint16_t flag)
00050 {
00051
00052 return((flag & FIRST_READ) && !(flag & SECOND_READ));
00053 }
00054 static inline bool isLastFragment(uint16_t flag)
00055 {
00056
00057 return(!(flag & FIRST_READ) && (flag & SECOND_READ));
00058 }
00059 static inline bool isMidFragment(uint16_t flag)
00060 {
00061
00062 return((flag & FIRST_READ) && (flag & SECOND_READ));
00063 }
00064 static inline bool isUnknownFragment(uint16_t flag)
00065 {
00066
00067 return(!(flag & FIRST_READ) && !(flag & SECOND_READ));
00068 }
00069
00070 static inline uint8_t getFragmentType(uint16_t flag)
00071 {
00072 return((flag & FRAGMENT_INFO) >> FRAGMENT_SHIFT);
00073 }
00074
00075 static inline void setUnmapped(uint16_t& flag) { flag |= UNMAPPED;}
00076
00077 private:
00078 SamFlag();
00079 };
00080
00081
00082 #endif