libStatGen Software 1
|
Class for helping to filter a SAM/BAM record. More...
#include <SamFilter.h>
Public Types | |
enum | FilterStatus { NONE , CLIPPED , FILTERED } |
Enum describing what sort of filtering was done. More... | |
Static Public Member Functions | |
static FilterStatus | clipOnMismatchThreshold (SamRecord &record, GenomeSequence &refSequence, double mismatchThreshold) |
Clip the read based on the specified mismatch threshold. | |
static FilterStatus | softClip (SamRecord &record, int32_t numFrontClips, int32_t numBackClips) |
Soft clip the record from the front and/or the back. | |
static FilterStatus | softClip (Cigar &oldCigar, int32_t numFrontClips, int32_t numBackClips, int32_t &startPos, CigarRoller &updatedCigar) |
Soft clip the cigar from the front and/or the back, writing the value into the new cigar, updatedCigar & startPos are only updated if the return FilterStatus is CLIPPED. | |
static FilterStatus | filterOnMismatchQuality (SamRecord &record, GenomeSequence &refSequence, uint32_t qualityThreshold, uint8_t defaultQualityInt) |
Filter the read based on the specified quality threshold. | |
static uint32_t | sumMismatchQuality (SamRecord &record, GenomeSequence &refSequence, uint8_t defaultQualityInt) |
Get the sum of the qualities of all mismatches in the record. | |
static void | filterRead (SamRecord &record) |
Filter the read by marking it as unmapped. | |
Class for helping to filter a SAM/BAM record.
Definition at line 25 of file SamFilter.h.
Enum describing what sort of filtering was done.
Enumerator | |
---|---|
NONE | The filter did not affect the read. |
CLIPPED | Filtering clipped the read. |
FILTERED | Filtering caused the read to be modified to unmapped. |
Definition at line 29 of file SamFilter.h.
|
static |
Clip the read based on the specified mismatch threshold.
Definition at line 27 of file SamFilter.cpp.
References SamQuerySeqWithRefIter::getNextMatchMismatch(), SamSingleBaseMatchInfo::getQueryIndex(), SamRecord::getReadLength(), SamSingleBaseMatchInfo::getType(), and softClip().
|
static |
Filter the read based on the specified quality threshold.
Definition at line 430 of file SamFilter.cpp.
References FILTERED, filterRead(), NONE, and sumMismatchQuality().
|
static |
Filter the read by marking it as unmapped.
Definition at line 486 of file SamFilter.cpp.
References SamRecord::getFlag(), SamRecord::setCigar(), SamRecord::setFlag(), SamRecord::setMapQuality(), and SamFlag::setUnmapped().
Referenced by filterOnMismatchQuality(), and softClip().
|
static |
Soft clip the cigar from the front and/or the back, writing the value into the new cigar, updatedCigar & startPos are only updated if the return FilterStatus is CLIPPED.
oldCigar | cigar prior to clipping |
numFrontClips | number of bases that should be clipped from the front of the sequence read. (total count, including any that are already clipped.) |
numBackClips | number of bases that should be clipped from the back of the sequence read. (total count, including any that are already clipped.) |
startPos | 0-based start position associated with the cigar prior to updating (input) and set to the 0-based start position after updating (output) the cigar if it was CLIPPED. |
updatedCigar | set to the clipped cigar if CLIPPED (output param). |
Definition at line 191 of file SamFilter.cpp.
References CigarRoller::Add(), CLIPPED, Cigar::del, FILTERED, Cigar::foundInQuery(), Cigar::getExpectedQueryBaseCount(), Cigar::getOperator(), Cigar::getRefPosition(), Cigar::hardClip, Cigar::INDEX_NA, Cigar::insert, Cigar::isClip(), Cigar::match, Cigar::mismatch, NONE, Cigar::none, Cigar::size(), Cigar::skip, and Cigar::softClip.
|
static |
Soft clip the record from the front and/or the back.
record | record to be clipped (input/output parameter). |
numFrontClips | number of bases that should be clipped from the front of the sequence read. (total count, including any that are already clipped.) |
backClipPos | number of bases that should be clipped from the back of the sequence read. (total count, including any that are already clipped.) |
Definition at line 155 of file SamFilter.cpp.
References CLIPPED, FILTERED, filterRead(), SamRecord::get0BasedPosition(), SamRecord::getCigarInfo(), NONE, SamRecord::set0BasedPosition(), SamRecord::setCigar(), and softClip().
Referenced by clipOnMismatchThreshold(), and softClip().
|
static |
Get the sum of the qualities of all mismatches in the record.
record | record on which to calculate the sum the mismatch qualities |
refSequence | reference to use to check for mismatches. |
defaultQualityInt | default value to use for the quality if no quality was specified in the read. |
Definition at line 451 of file SamFilter.cpp.
References SamQuerySeqWithRefIter::getNextMatchMismatch(), BaseUtilities::getPhredBaseQuality(), SamRecord::getQuality(), SamSingleBaseMatchInfo::getQueryIndex(), SamSingleBaseMatchInfo::getType(), and BaseUtilities::UNKNOWN_QUALITY_INT.
Referenced by filterOnMismatchQuality().