Loading...
Searching...
No Matches
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).
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 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 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).
static uint8_t | getFragmentType (uint16_t flag)
static void | setUnmapped (uint16_t &flag)
| Mark the passed in flag as unmapped.
static void | setNotDuplicate (uint16_t &flag)
| Mark the passed in flag as not duplicate.
static void | setDuplicate (uint16_t &flag)
| Mark the passed in flag as not duplicate.

## Detailed Description

Class for extracting information from a SAM Flag.

Definition at line 28 of file SamFlag.h.

## Member Function Documentation

## getFragmentType()

uint8_t SamFlag::getFragmentType | ( | uint16_t | flag | ) |

inline static

Definition at line 98 of file SamFlag.h.

{
return((flag & FRAGMENT_INFO) >> FRAGMENT_SHIFT);
}

## isDuplicate()

bool SamFlag::isDuplicate | ( | uint16_t | flag | ) |

inline static

Definition at line 64 of file SamFlag.h.

{return(flag & DUPLICATE);}

## isFirstFragment()

bool SamFlag::isFirstFragment | ( | uint16_t | flag | ) |

inline static

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.

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

## isLastFragment()

bool SamFlag::isLastFragment | ( | uint16_t | flag | ) |

inline static

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.

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

## isMapped()

bool SamFlag::isMapped | ( | uint16_t | flag | ) |

inline static

Definition at line 53 of file SamFlag.h.

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

## isMateMapped()

bool SamFlag::isMateMapped | ( | uint16_t | flag | ) |

inline static

Definition at line 54 of file SamFlag.h.

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

## isMateReverse()

bool SamFlag::isMateReverse | ( | uint16_t | flag | ) |

inline static

Definition at line 58 of file SamFlag.h.

{return(flag & MATE_REVERSED);}

## isMidFragment()

bool SamFlag::isMidFragment | ( | uint16_t | flag | ) |

inline static

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.

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

## isPaired()

bool SamFlag::isPaired | ( | uint16_t | flag | ) |

inline static

Definition at line 56 of file SamFlag.h.

{return(flag & PAIRED);}

## isProperPair()

bool SamFlag::isProperPair | ( | uint16_t | flag | ) |

inline static

Definition at line 59 of file SamFlag.h.

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

## isQCFailure()

bool SamFlag::isQCFailure | ( | uint16_t | flag | ) |

inline static

Definition at line 65 of file SamFlag.h.

{return(flag & FAILED_QUALITY);}

## isReverse()

bool SamFlag::isReverse | ( | uint16_t | flag | ) |

inline static

Definition at line 57 of file SamFlag.h.

{return(flag & REVERSE);}

## isSecondary()

bool SamFlag::isSecondary | ( | uint16_t | flag | ) |

inline static

Definition at line 67 of file SamFlag.h.

{return(flag & SECONDARY_ALIGNMENT);}

## isUnknownFragment()

bool SamFlag::isUnknownFragment | ( | uint16_t | flag | ) |

inline static

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.

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

## setDuplicate()

void SamFlag::setDuplicate | ( | uint16_t & | flag | ) |

inline static

Mark the passed in flag as not duplicate.

Definition at line 108 of file SamFlag.h.

{ flag |= DUPLICATE;}

## setNotDuplicate()

void SamFlag::setNotDuplicate | ( | uint16_t & | flag | ) |

inline static

Mark the passed in flag as not duplicate.

Definition at line 106 of file SamFlag.h.

{ flag ^= DUPLICATE;}

## setUnmapped()

void SamFlag::setUnmapped | ( | uint16_t & | flag | ) |

inline static

Mark the passed in flag as unmapped.

Definition at line 104 of file SamFlag.h.

{ 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:

- bam/SamFlag.h