BaiIndexedBamReader¶
#include <pbbam/BaiIndexedBamReader.h>
-
class
PacBio::BAM::
BaiIndexedBamReader
¶ The BaiIndexedBamReader class provides read-only iteration over BAM records, bounded by a particular genomic interval.
The SAM/BAM standard index (*.bai) is used to allow random-access operations.
Inherits from PacBio::BAM::BamReader
Constructors & Related Methods
-
BaiIndexedBamReader
(const GenomicInterval &interval, const std::string &filename)¶ Constructs BAM reader, bounded by a genomic interval.
All reads that overlap the interval will be available.
- Parameters
interval
: iteration will be bounded by this GenomicInterval.filename
: input BAM filename
- Exceptions
std::runtime_error
: if either file (*.bam or *.bai) fails to open for reading, or if the interval is invalid
-
BaiIndexedBamReader
(const GenomicInterval &interval, const BamFile &bamFile)¶ Constructs BAM reader, bounded by a genomic interval.
All reads that overlap the interval will be available.
- Parameters
interval
: iteration will be bounded by this GenomicInterval.bamFile
: input BamFile object
- Exceptions
std::runtime_error
: if either file (*.bam or *.bai) fails to open for reading, or if the interval is invalid
-
BaiIndexedBamReader
(const GenomicInterval &interval, BamFile &&bamFile)¶ Constructs BAM reader, bounded by a genomic interval.
All reads that overlap the interval will be available.
- Parameters
interval
: iteration will be bounded by this GenomicInterval.bamFile
: input BamFile object
- Exceptions
std::runtime_error
: if either file (*.bam or *.bai) fails to open for reading, or if the interval is invalid
Random-Access
-
const GenomicInterval &
Interval
() const¶ - Return
- the current GenomicInterval in use by this reader
-
BaiIndexedBamReader &
Interval
(const GenomicInterval &interval)¶ Sets a new genomic interval on the reader.
- Return
- reference to this reader
- Parameters
interval
:
Protected Functions
-
int
ReadRawData
(BGZF *bgzf, bam1_t *b)¶ Performs the actual raw read of the next record from the BAM file.
Default implementation will read records, sequentially, until EOF. Derived readers may use additional criteria to decide which record is “next” and when reading is done.
Return value should be equivalent to htslib’s bam_read1(): >= 0 : normal -1 : EOF (not an error) < -1 : error
- Return
- integer status code, see description
- Parameters
bgzf
: BGZF stream pointerb
: BAM record pointer
-