isoSeqQC
Quality assessment and re-mapping of poorly mapped isoSeq read segments
Loading...
Searching...
No Matches
isaSpace::BAMrecord Class Reference

Summary of a BAM record set. More...

#include <isoseqAlgn.hpp>

Public Member Functions

 BAMrecord ()=default
 Default constructor.
 BAMrecord (const bam1_t *alignmentRecord, const sam_hdr_t *samHeader)
 Constructor with data.
 BAMrecord (const BAMrecord &toCopy)=default
 Copy constructor.
BAMrecordoperator= (const BAMrecord &toCopy)=default
 Copy assignment operator.
 BAMrecord (BAMrecord &&toMove) noexcept=default
 Move constructor.
BAMrecordoperator= (BAMrecord &&toMove) noexcept=default
 Move assignment operator.
 ~BAMrecord ()=default
 Destructor.
void addSecondaryAlignment (const bam1_t *alignmentRecord, const sam_hdr_t *samHeader, const hts_pos_t localWindow=500 '000)
 Add a secondary alignment record.
std::string getReadName () const
 Output read name.
hts_pos_t getMapStart () const noexcept
 Map start position.
hts_pos_t getMapEnd () const noexcept
 Map end position.
hts_pos_t getmRNAstart () const noexcept
 mRNA start position
bool isRevComp () const noexcept
 Is the read reverse-complemented?
bool isMapped () const noexcept
 Is the read mapped?
bool hasSecondaryAlignments () const noexcept
 Are there any secondary alignments?
bool hasLocalSecondaryAlignments () const noexcept
 Are there any local secondary alignments?
uint16_t secondaryAlignmentCount () const noexcept
 Count of all secondary alignments regardless of position.
uint16_t localSecondaryAlignmentCount () const noexcept
 Count of secondary alignments overlapping the primary.
uint16_t localReversedSecondaryAlignmentCount () const noexcept
 Count of reversed secondary alignments overlapping the primary.
hts_pos_t getReadLength () const noexcept
 Read length.
std::vector< uint32_t > getCIGARvector () const
 CIGAR vector.
std::string getCIGARstring () const
 CIGAR string.
uint32_t getFirstCIGAR () const noexcept
 Get the first cigar element with strand reversal.
std::string getReferenceName () const
 Get reference name.
MappedReadMatchStatus getBestReferenceMatchStatus () const
 Best reference-centric match status.
std::vector< std::pair< float, hts_pos_t > > getReadCentricMatchStatus () const
 Reference match status along the read.
std::vector< MappedReadIntervalgetPoorlyMappedRegions (const BinomialWindowParameters &windowParameters) const
 Identify unmapped portions of the read.
std::string getSequenceAndQuality (const MappedReadInterval &segmentBoundaries) const
 Get a segment of the sequence and the ASCII quality score.

Detailed Description

Summary of a BAM record set.

Stores relevant information from BAM format alignment records.

Constructor & Destructor Documentation

◆ BAMrecord() [1/3]

isaSpace::BAMrecord::BAMrecord ( const bam1_t * alignmentRecord,
const sam_hdr_t * samHeader )

Constructor with data.

Constructs an object from an HTSLIB alignment record and the corresponding header.

Parameters
[in]alignmentRecordpointer to a read alignment record
[in]samHeaderpointer to the corresponding BAM/SAM header

◆ BAMrecord() [2/3]

isaSpace::BAMrecord::BAMrecord ( const BAMrecord & toCopy)
default

Copy constructor.

Parameters
[in]toCopyobject to copy

◆ BAMrecord() [3/3]

isaSpace::BAMrecord::BAMrecord ( BAMrecord && toMove)
defaultnoexcept

Move constructor.

Parameters
[in]toMoveobject to move

Member Function Documentation

◆ addSecondaryAlignment()

void isaSpace::BAMrecord::addSecondaryAlignment ( const bam1_t * alignmentRecord,
const sam_hdr_t * samHeader,
const hts_pos_t localWindow = 500 '000 )

Add a secondary alignment record.

Adds information from a secondary alignment record if it is a local secondary alignment. Otherwise, only increments the total number of secondary alignments.

Parameters
[in]alignmentRecordpointer to a read alignment record
[in]samHeaderpointer to the corresponding BAM/SAM header
[in]localWindowwindow size for a secondary alignment to be considered local

◆ getBestReferenceMatchStatus()

MappedReadMatchStatus isaSpace::BAMrecord::getBestReferenceMatchStatus ( ) const
nodiscard

Best reference-centric match status.

For each position, best match among all primary and secondary alignments.

Returns
match status with map start

◆ getCIGARstring()

std::string isaSpace::BAMrecord::getCIGARstring ( ) const
nodiscard

CIGAR string.

Reversed if the read is reverse-complemented.

Returns
CIGAR string

◆ getCIGARvector()

std::vector< uint32_t > isaSpace::BAMrecord::getCIGARvector ( ) const
inlinenodiscard

CIGAR vector.

Orientation independent of strand

Returns
CIGAR vector

◆ getFirstCIGAR()

uint32_t isaSpace::BAMrecord::getFirstCIGAR ( ) const
nodiscardnoexcept

Get the first cigar element with strand reversal.

Returns
first CIGAR vector element or 0 if none

◆ getMapEnd()

hts_pos_t isaSpace::BAMrecord::getMapEnd ( ) const
inlinenodiscardnoexcept

Map end position.

Position of the first past the mapped region of the reference.

Returns
1-based read map end position

◆ getMapStart()

hts_pos_t isaSpace::BAMrecord::getMapStart ( ) const
inlinenodiscardnoexcept

Map start position.

Position of the first mapped nucleotide.

Returns
1-based read map start position

◆ getmRNAstart()

hts_pos_t isaSpace::BAMrecord::getmRNAstart ( ) const
inlinenodiscardnoexcept

mRNA start position

Position of the first mRNA read nucleotide, taking into account possible reverse-complement.

Returns
1-based read mRNA start position

◆ getPoorlyMappedRegions()

std::vector< MappedReadInterval > isaSpace::BAMrecord::getPoorlyMappedRegions ( const BinomialWindowParameters & windowParameters) const
nodiscard

Identify unmapped portions of the read.

Returns a vector of poorly mapped portions of the read. Vector is empty if the read is mapped.

Parameters
[in]windowParameterswindow parameters: size and the mapped/unmapped region binomial probabilities
Returns
vector of poorly mapped region coordinates

◆ getReadCentricMatchStatus()

std::vector< std::pair< float, hts_pos_t > > isaSpace::BAMrecord::getReadCentricMatchStatus ( ) const
nodiscard

Reference match status along the read.

Parses CIGAR to track reference match/mismatch (1.0 for match, 0.0 for mismatch) status along the read, relating each read position to the corresponding reference base-1 nucleotide position. The vector start begins at the position closest to the first exon start regardless of strand.

Returns
vector of match status/reference position pairs

◆ getReadLength()

hts_pos_t isaSpace::BAMrecord::getReadLength ( ) const
inlinenodiscardnoexcept

Read length.

Returns
read length in bases

◆ getReadName()

std::string isaSpace::BAMrecord::getReadName ( ) const
inlinenodiscard

Output read name.

Returns
read name

◆ getReferenceName()

std::string isaSpace::BAMrecord::getReferenceName ( ) const
inlinenodiscard

Get reference name.

Reference sequence (e.g., chromosome) name. If absent, returns * like samtools.

Returns
reference name

◆ getSequenceAndQuality()

std::string isaSpace::BAMrecord::getSequenceAndQuality ( const MappedReadInterval & segmentBoundaries) const
nodiscard

Get a segment of the sequence and the ASCII quality score.

Returns sequence and printable ASCII quality scores separated by a newline, with a newline at the end. Negative strand alignments are reverse-complemented to export the original strand.

Parameters
[in]segmentBoundariesread interval to retrieve
Returns
sequence and quality

◆ hasLocalSecondaryAlignments()

bool isaSpace::BAMrecord::hasLocalSecondaryAlignments ( ) const
inlinenodiscardnoexcept

Are there any local secondary alignments?

Returns
true if there are any secondary alignments overlapping the primary

◆ hasSecondaryAlignments()

bool isaSpace::BAMrecord::hasSecondaryAlignments ( ) const
inlinenodiscardnoexcept

Are there any secondary alignments?

Returns
true if there are any secondary alignments

◆ isMapped()

bool isaSpace::BAMrecord::isMapped ( ) const
inlinenodiscardnoexcept

Is the read mapped?

Returns
true if the read is mapped

◆ isRevComp()

bool isaSpace::BAMrecord::isRevComp ( ) const
inlinenodiscardnoexcept

Is the read reverse-complemented?

Returns
true if the read is reverse-complemented

◆ localReversedSecondaryAlignmentCount()

uint16_t isaSpace::BAMrecord::localReversedSecondaryAlignmentCount ( ) const
nodiscardnoexcept

Count of reversed secondary alignments overlapping the primary.

Returns
Local reversed secondary alignment count

◆ localSecondaryAlignmentCount()

uint16_t isaSpace::BAMrecord::localSecondaryAlignmentCount ( ) const
inlinenodiscardnoexcept

Count of secondary alignments overlapping the primary.

Returns
Local secondary alignment count

◆ operator=() [1/2]

BAMrecord & isaSpace::BAMrecord::operator= ( BAMrecord && toMove)
defaultnoexcept

Move assignment operator.

Parameters
[in]toMoveobject to move
Returns
BAMrecord object

◆ operator=() [2/2]

BAMrecord & isaSpace::BAMrecord::operator= ( const BAMrecord & toCopy)
default

Copy assignment operator.

Parameters
[in]toCopyobject to copy
Returns
BAMrecord object

◆ secondaryAlignmentCount()

uint16_t isaSpace::BAMrecord::secondaryAlignmentCount ( ) const
inlinenodiscardnoexcept

Count of all secondary alignments regardless of position.

Returns
Secondary alignment count

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