|
BamTools 2.5.2
|
The main BAM alignment data structure. More...
#include <BamAlignment.h>
Public Member Functions | |
| BamAlignment () | |
| constructor More... | |
| bool | IsDuplicate () const |
| bool | IsFailedQC () const |
| bool | IsFirstMate () const |
| bool | IsMapped () const |
| bool | IsMateMapped () const |
| bool | IsMateReverseStrand () const |
| bool | IsPaired () const |
| bool | IsSupplementary () const |
| bool | IsPrimaryAlignment () const |
| bool | IsProperPair () const |
| bool | IsReverseStrand () const |
| bool | IsSecondMate () const |
| void | SetIsDuplicate (bool ok) |
| Sets value of "PCR duplicate" flag to ok. More... | |
| void | SetIsFailedQC (bool ok) |
| Sets "failed quality control" flag to ok. More... | |
| void | SetIsFirstMate (bool ok) |
| Sets "alignment is first mate" flag to ok. More... | |
| void | SetIsMapped (bool ok) |
| Sets "alignment is mapped" flag to ok. More... | |
| void | SetIsMateMapped (bool ok) |
| Sets "alignment's mate is mapped" flag to ok. More... | |
| void | SetIsMateReverseStrand (bool ok) |
| Sets "alignment's mate mapped to reverse strand" flag to ok. More... | |
| void | SetIsPaired (bool ok) |
| Sets "alignment part of paired-end read" flag to ok. More... | |
| void | SetIsPrimaryAlignment (bool ok) |
| Sets "position is primary alignment" flag to ok. More... | |
| void | SetIsProperPair (bool ok) |
| Sets "alignment is part of read that satisfied paired-end resolution" flag to ok. More... | |
| void | SetIsReverseStrand (bool ok) |
| Sets "alignment mapped to reverse strand" flag to ok. More... | |
| void | SetIsSecondMate (bool ok) |
| Sets "alignment is second mate on read" flag to ok. More... | |
| template<typename T > | |
| bool | AddTag (const std::string &tag, const std::string &type, const T &value) |
| template<typename T > | |
| bool | AddTag (const std::string &tag, const std::vector< T > &values) |
| template<typename T > | |
| bool | EditTag (const std::string &tag, const std::string &type, const T &value) |
| template<typename T > | |
| bool | EditTag (const std::string &tag, const std::vector< T > &values) |
| template<typename T > | |
| bool | GetTag (const std::string &tag, T &destination) const |
| template<typename T > | |
| bool | GetTag (const std::string &tag, std::vector< T > &destination) const |
| std::vector< std::string > | GetTagNames () const |
| Retrieves the BAM tag names. More... | |
| bool | GetTagType (const std::string &tag, char &type) const |
| Retrieves the BAM tag type-code associated with requested tag name. More... | |
| bool | GetArrayTagType (const std::string &tag, char &type) const |
| Retrieves the BAM tag type-code for the array elements associated with requested tag name. More... | |
| bool | HasTag (const std::string &tag) const |
| Returns true if alignment has a record for requested tag. More... | |
| void | RemoveTag (const std::string &tag) |
| Removes field from BAM tags. More... | |
| bool | BuildCharData () |
| Populates alignment string fields (read name, bases, qualities, tag data). More... | |
| int | GetEndPosition (bool usePadded=false, bool closedInterval=false) const |
| Calculates alignment end position, based on its starting position and CIGAR data. More... | |
| std::string | GetErrorString () const |
| Returns a human-readable description of the last error that occurred. More... | |
| bool | GetSoftClips (std::vector< int > &clipSizes, std::vector< int > &readPositions, std::vector< int > &genomePositions, bool usePadded=false) const |
| Identifies if an alignment has a soft clip. If so, identifies the sizes of the soft clips, as well as their positions in the read and reference. More... | |
Public Attributes | |
| std::string | Name |
| read name More... | |
| int32_t | Length |
| length of query sequence More... | |
| std::string | QueryBases |
| 'original' sequence (as reported from sequencing machine) More... | |
| std::string | AlignedBases |
| 'aligned' sequence (includes any indels, padding, clipping) More... | |
| std::string | Qualities |
| FASTQ qualities (ASCII characters, not numeric values) More... | |
| std::string | TagData |
| tag data (use the provided methods to query/modify) More... | |
| int32_t | RefID |
| ID number for reference sequence. More... | |
| int32_t | Position |
| position (0-based) where alignment starts More... | |
| uint16_t | Bin |
| BAM (standard) index bin number for this alignment. More... | |
| uint16_t | MapQuality |
| mapping quality score More... | |
| uint32_t | AlignmentFlag |
| alignment bit-flag (use the provided methods to query/modify) More... | |
| std::vector< CigarOp > | CigarData |
| CIGAR operations for this alignment. More... | |
| int32_t | MateRefID |
| ID number for reference sequence where alignment's mate was aligned. More... | |
| int32_t | MatePosition |
| position (0-based) where alignment's mate starts More... | |
| int32_t | InsertSize |
| mate-pair insert size More... | |
| std::string | Filename |
| name of BAM file which this alignment comes from More... | |
Friends | |
| class | Internal::BamReaderPrivate |
| class | Internal::BamWriterPrivate |
The main BAM alignment data structure.
Provides methods to query/modify BAM alignment data fields.
| BamAlignment::BamAlignment | ( | ) |
constructor
| bool BamTools::BamAlignment::AddTag | ( | const std::string & | tag, |
| const std::string & | type, | ||
| const T & | value | ||
| ) |
| bool BamTools::BamAlignment::AddTag | ( | const std::string & | tag, |
| const std::vector< T > & | values | ||
| ) |
| bool BamAlignment::BuildCharData | ( | ) |
Populates alignment string fields (read name, bases, qualities, tag data).
An alignment retrieved using BamReader::GetNextAlignmentCore() lacks this data. Using that method makes parsing much quicker when only positional data is required.
However, if you later want to access the character data fields from such an alignment, use this method to populate those fields. Provides ability to do 'lazy evaluation' of alignment parsing.
true if character data populated successfully (or was already available to begin with) | bool BamTools::BamAlignment::EditTag | ( | const std::string & | tag, |
| const std::string & | type, | ||
| const T & | value | ||
| ) |
| bool BamTools::BamAlignment::EditTag | ( | const std::string & | tag, |
| const std::vector< T > & | values | ||
| ) |
| bool BamAlignment::GetArrayTagType | ( | const std::string & | tag, |
| char & | type | ||
| ) | const |
Retrieves the BAM tag type-code for the array elements associated with requested tag name.
| [in] | tag | 2-character tag name |
| [out] | type | retrieved (1-character) type-code |
true if found. False if not found, or if tag is not an array type. | int BamAlignment::GetEndPosition | ( | bool | usePadded = false, |
| bool | closedInterval = false |
||
| ) | const |
Calculates alignment end position, based on its starting position and CIGAR data.
| [in] | usePadded | Allow inserted bases to affect the reported position. Default is false, so that reported position stays synced with reference coordinates. |
| [in] | closedInterval | Setting this to true will return a 0-based end coordinate. Default is false, so that his value represents a standard, half-open interval. |
| std::string BamAlignment::GetErrorString | ( | ) | const |
Returns a human-readable description of the last error that occurred.
This method allows elimination of STDERR pollution. Developers of client code may choose how the messages are displayed to the user, if at all.
| bool BamAlignment::GetSoftClips | ( | std::vector< int > & | clipSizes, |
| std::vector< int > & | readPositions, | ||
| std::vector< int > & | genomePositions, | ||
| bool | usePadded = false |
||
| ) | const |
Identifies if an alignment has a soft clip. If so, identifies the sizes of the soft clips, as well as their positions in the read and reference.
| [out] | clipSizes | vector of the sizes of each soft clip in the alignment |
| [out] | readPositions | vector of the 0-based read locations of each soft clip in the alignment. These positions are basically indexes within the read, not genomic positions. |
| [out] | genomePositions | vector of the 0-based genome locations of each soft clip in the alignment |
| [in] | usePadded | inserted bases affect reported position. Default is false, so that reported position stays 'sync-ed' with reference coordinates. |
true if any soft clips were found in the alignment | bool BamTools::BamAlignment::GetTag | ( | const std::string & | tag, |
| std::vector< T > & | destination | ||
| ) | const |
| bool BamTools::BamAlignment::GetTag | ( | const std::string & | tag, |
| T & | destination | ||
| ) | const |
| std::vector< std::string > BamAlignment::GetTagNames | ( | ) | const |
Retrieves the BAM tag names.
When paired with GetTagType() and GetTag(), this method allows you to iterate over an alignment's tag data without knowing the names (or types) beforehand.
vector containing all tag names found (empty if none available) | bool BamAlignment::GetTagType | ( | const std::string & | tag, |
| char & | type | ||
| ) | const |
Retrieves the BAM tag type-code associated with requested tag name.
| [in] | tag | 2-character tag name |
| [out] | type | retrieved (1-character) type-code |
true if found | bool BamAlignment::HasTag | ( | const std::string & | tag | ) | const |
Returns true if alignment has a record for requested tag.
| [in] | tag | 2-character tag name |
true if alignment has a record for tag | bool BamAlignment::IsDuplicate | ( | ) | const |
true if this read is a PCR duplicate | bool BamAlignment::IsFailedQC | ( | ) | const |
true if this read failed quality control | bool BamAlignment::IsFirstMate | ( | ) | const |
true if alignment is first mate on paired-end read | bool BamAlignment::IsMapped | ( | ) | const |
true if alignment is mapped | bool BamAlignment::IsMateMapped | ( | ) | const |
true if alignment's mate is mapped | bool BamAlignment::IsMateReverseStrand | ( | ) | const |
true if alignment's mate mapped to reverse strand | bool BamAlignment::IsPaired | ( | ) | const |
true if alignment part of paired-end read | bool BamAlignment::IsPrimaryAlignment | ( | ) | const |
true if reported position is primary alignment | bool BamAlignment::IsProperPair | ( | ) | const |
true if alignment is part of read that satisfied paired-end resolution | bool BamAlignment::IsReverseStrand | ( | ) | const |
true if alignment mapped to reverse strand | bool BamAlignment::IsSecondMate | ( | ) | const |
true if alignment is second mate on read | bool BamAlignment::IsSupplementary | ( | ) | const |
true if this read is supplementary | void BamAlignment::RemoveTag | ( | const std::string & | tag | ) |
Removes field from BAM tags.
| [in] | tag | 2-character name of field to remove |
| void BamAlignment::SetIsDuplicate | ( | bool | ok | ) |
Sets value of "PCR duplicate" flag to ok.
| void BamAlignment::SetIsFailedQC | ( | bool | ok | ) |
Sets "failed quality control" flag to ok.
| void BamAlignment::SetIsFirstMate | ( | bool | ok | ) |
Sets "alignment is first mate" flag to ok.
| void BamAlignment::SetIsMapped | ( | bool | ok | ) |
Sets "alignment is mapped" flag to ok.
| void BamAlignment::SetIsMateMapped | ( | bool | ok | ) |
Sets "alignment's mate is mapped" flag to ok.
| void BamAlignment::SetIsMateReverseStrand | ( | bool | ok | ) |
Sets "alignment's mate mapped to reverse strand" flag to ok.
| void BamAlignment::SetIsPaired | ( | bool | ok | ) |
Sets "alignment part of paired-end read" flag to ok.
| void BamAlignment::SetIsPrimaryAlignment | ( | bool | ok | ) |
Sets "position is primary alignment" flag to ok.
| void BamAlignment::SetIsProperPair | ( | bool | ok | ) |
Sets "alignment is part of read that satisfied paired-end resolution" flag to ok.
| void BamAlignment::SetIsReverseStrand | ( | bool | ok | ) |
Sets "alignment mapped to reverse strand" flag to ok.
| void BamAlignment::SetIsSecondMate | ( | bool | ok | ) |
Sets "alignment is second mate on read" flag to ok.
|
friend |
|
friend |
| BamAlignment::AlignedBases |
'aligned' sequence (includes any indels, padding, clipping)
This field will be completely empty after reading from BamReader/BamMultiReader when QueryBases is empty.
| BamAlignment::AlignmentFlag |
alignment bit-flag (use the provided methods to query/modify)
| BamAlignment::Bin |
BAM (standard) index bin number for this alignment.
| BamAlignment::CigarData |
CIGAR operations for this alignment.
| BamAlignment::Filename |
name of BAM file which this alignment comes from
| BamAlignment::InsertSize |
mate-pair insert size
| BamAlignment::Length |
length of query sequence
| BamAlignment::MapQuality |
mapping quality score
| BamAlignment::MatePosition |
position (0-based) where alignment's mate starts
| BamAlignment::MateRefID |
ID number for reference sequence where alignment's mate was aligned.
| BamAlignment::Name |
read name
| BamAlignment::Position |
position (0-based) where alignment starts
| BamAlignment::Qualities |
FASTQ qualities (ASCII characters, not numeric values)
| BamAlignment::QueryBases |
'original' sequence (as reported from sequencing machine)
| BamAlignment::RefID |
ID number for reference sequence.
| BamAlignment::TagData |
tag data (use the provided methods to query/modify)