libStatGen Software 1
SamFlag Class Reference

Class for extracting information from a SAM Flag. More...

#include <SamFlag.h>

Static Public Attributes

Constants for parsing a flag.
static const int16_t PAIRED = 0x0001
 
static const int16_t PROPER_PAIR = 0x0002
 
static const int16_t UNMAPPED = 0x0004
 
static const int16_t MATE_UNMAPPED = 0x0008
 
static const int16_t REVERSE = 0x0010
 
static const int16_t MATE_REVERSED = 0x0020
 
static const int16_t FIRST_READ = 0x0040
 
static const int16_t SECOND_READ = 0x0080
 
static const int16_t SECONDARY_ALIGNMENT = 0x0100
 
static const int16_t FAILED_QUALITY = 0x0200
 
static const int16_t DUPLICATE = 0x0400
 
static const int16_t SUPPLEMENTARY_ALIGNMENT = 0x0800
 
static const int16_t FRAGMENT_INFO = 0x00C0
 
static const int16_t FRAGMENT_SHIFT = 6
 

Static methods for determining the contents of a flag.

static bool isMapped (uint16_t flag)
 
static bool isMateMapped (uint16_t flag)
 
static bool isPaired (uint16_t flag)
 
static bool isReverse (uint16_t flag)
 
static bool isMateReverse (uint16_t flag)
 
static bool isProperPair (uint16_t flag)
 
static bool isDuplicate (uint16_t flag)
 
static bool isQCFailure (uint16_t flag)
 
static bool isSecondary (uint16_t flag)
 
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). More...
 
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). More...
 
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). More...
 
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 not set). More...
 
static uint8_t getFragmentType (uint16_t flag)
 
static void setUnmapped (uint16_t &flag)
 Mark the passed in flag as unmapped. More...
 
static void setNotDuplicate (uint16_t &flag)
 Mark the passed in flag as not duplicate. More...
 
static void setDuplicate (uint16_t &flag)
 Mark the passed in flag as not duplicate. More...
 

Detailed Description

Class for extracting information from a SAM Flag.

Definition at line 28 of file SamFlag.h.

Member Function Documentation

◆ getFragmentType()

static uint8_t SamFlag::getFragmentType ( uint16_t  flag)
inlinestatic

Definition at line 98 of file SamFlag.h.

99 {
100 return((flag & FRAGMENT_INFO) >> FRAGMENT_SHIFT);
101 }

◆ isDuplicate()

static bool SamFlag::isDuplicate ( uint16_t  flag)
inlinestatic

Definition at line 64 of file SamFlag.h.

64{return(flag & DUPLICATE);}

◆ isFirstFragment()

static bool SamFlag::isFirstFragment ( uint16_t  flag)
inlinestatic

Return if it is the first fragment or not (if FIRST_READ is set and SECOND_READ is not).

Definition at line 71 of file SamFlag.h.

72 {
73 // first fragment if FIRST_READ is set and SECOND_READ is not.
74 return((flag & FIRST_READ) && !(flag & SECOND_READ));
75 }

◆ isLastFragment()

static bool SamFlag::isLastFragment ( uint16_t  flag)
inlinestatic

Return if it is the last fragment or not (if FIRST_READ is not set and SECOND_READ is).

Definition at line 78 of file SamFlag.h.

79 {
80 // last fragment if FIRST_READ is not set and SECOND_READ is set.
81 return(!(flag & FIRST_READ) && (flag & SECOND_READ));
82 }

◆ isMapped()

static bool SamFlag::isMapped ( uint16_t  flag)
inlinestatic

Definition at line 53 of file SamFlag.h.

53{return(!(flag & UNMAPPED));}

◆ isMateMapped()

static bool SamFlag::isMateMapped ( uint16_t  flag)
inlinestatic

Definition at line 54 of file SamFlag.h.

54{return(!(flag & MATE_UNMAPPED));}

◆ isMateReverse()

static bool SamFlag::isMateReverse ( uint16_t  flag)
inlinestatic

Definition at line 58 of file SamFlag.h.

58{return(flag & MATE_REVERSED);}

◆ isMidFragment()

static bool SamFlag::isMidFragment ( uint16_t  flag)
inlinestatic

Return if it is a middle fragment or not (if FIRST_READ is set and SECOND_READ is also set).

Definition at line 85 of file SamFlag.h.

86 {
87 // mid fragment if both FIRST_READ and SECOND_READ are set.
88 return((flag & FIRST_READ) && (flag & SECOND_READ));
89 }

◆ isPaired()

static bool SamFlag::isPaired ( uint16_t  flag)
inlinestatic

Definition at line 56 of file SamFlag.h.

56{return(flag & PAIRED);}

◆ isProperPair()

static bool SamFlag::isProperPair ( uint16_t  flag)
inlinestatic

Definition at line 59 of file SamFlag.h.

60 {
61 // Proper pair is only applicable if also paired.
62 return(isPaired(flag) && (flag & PROPER_PAIR));
63 }

◆ isQCFailure()

static bool SamFlag::isQCFailure ( uint16_t  flag)
inlinestatic

Definition at line 65 of file SamFlag.h.

65{return(flag & FAILED_QUALITY);}

◆ isReverse()

static bool SamFlag::isReverse ( uint16_t  flag)
inlinestatic

Definition at line 57 of file SamFlag.h.

57{return(flag & REVERSE);}

◆ isSecondary()

static bool SamFlag::isSecondary ( uint16_t  flag)
inlinestatic

Definition at line 67 of file SamFlag.h.

67{return(flag & SECONDARY_ALIGNMENT);}

◆ isUnknownFragment()

static bool SamFlag::isUnknownFragment ( uint16_t  flag)
inlinestatic

Return if it is an unknown fragment fragment or not (if FIRST_READ is not set and SECOND_READ is also not set).

Definition at line 92 of file SamFlag.h.

93 {
94 // unknown fragment index if neither FIRST_READ nor SECOND_READ are not.
95 return(!(flag & FIRST_READ) && !(flag & SECOND_READ));
96 }

◆ setDuplicate()

static void SamFlag::setDuplicate ( uint16_t &  flag)
inlinestatic

Mark the passed in flag as not duplicate.

Definition at line 108 of file SamFlag.h.

108{ flag |= DUPLICATE;}

◆ setNotDuplicate()

static void SamFlag::setNotDuplicate ( uint16_t &  flag)
inlinestatic

Mark the passed in flag as not duplicate.

Definition at line 106 of file SamFlag.h.

106{ flag ^= DUPLICATE;}

◆ setUnmapped()

static void SamFlag::setUnmapped ( uint16_t &  flag)
inlinestatic

Mark the passed in flag as unmapped.

Definition at line 104 of file SamFlag.h.

104{ flag |= UNMAPPED;}

Referenced by SamFilter::filterRead().

Member Data Documentation

◆ DUPLICATE

const int16_t SamFlag::DUPLICATE = 0x0400
static

Definition at line 44 of file SamFlag.h.

◆ FAILED_QUALITY

const int16_t SamFlag::FAILED_QUALITY = 0x0200
static

Definition at line 43 of file SamFlag.h.

◆ FIRST_READ

const int16_t SamFlag::FIRST_READ = 0x0040
static

Definition at line 40 of file SamFlag.h.

◆ FRAGMENT_INFO

const int16_t SamFlag::FRAGMENT_INFO = 0x00C0
static

Definition at line 46 of file SamFlag.h.

◆ FRAGMENT_SHIFT

const int16_t SamFlag::FRAGMENT_SHIFT = 6
static

Definition at line 47 of file SamFlag.h.

◆ MATE_REVERSED

const int16_t SamFlag::MATE_REVERSED = 0x0020
static

Definition at line 39 of file SamFlag.h.

◆ MATE_UNMAPPED

const int16_t SamFlag::MATE_UNMAPPED = 0x0008
static

Definition at line 37 of file SamFlag.h.

◆ PAIRED

const int16_t SamFlag::PAIRED = 0x0001
static

Definition at line 34 of file SamFlag.h.

◆ PROPER_PAIR

const int16_t SamFlag::PROPER_PAIR = 0x0002
static

Definition at line 35 of file SamFlag.h.

◆ REVERSE

const int16_t SamFlag::REVERSE = 0x0010
static

Definition at line 38 of file SamFlag.h.

◆ SECOND_READ

const int16_t SamFlag::SECOND_READ = 0x0080
static

Definition at line 41 of file SamFlag.h.

◆ SECONDARY_ALIGNMENT

const int16_t SamFlag::SECONDARY_ALIGNMENT = 0x0100
static

Definition at line 42 of file SamFlag.h.

◆ SUPPLEMENTARY_ALIGNMENT

const int16_t SamFlag::SUPPLEMENTARY_ALIGNMENT = 0x0800
static

Definition at line 45 of file SamFlag.h.

◆ UNMAPPED

const int16_t SamFlag::UNMAPPED = 0x0004
static

Definition at line 36 of file SamFlag.h.


The documentation for this class was generated from the following file: