EntireFileQuery

#include <pbbam/EntireFileQuery.h>
class PacBio::BAM::EntireFileQuery

The EntireFileQuery class provides iterable access to a DataSet‘s BAM records, reading through the entire contents of each file.

Input files will be accessed in the order listed in the DataSet.

// using C++11 range-based for loop
EntireFileQuery query(dataset);
for (const BamRecord& record : query) {
    // ... do stuff ...
}

// OR

// using iterators
EntireFileQuery query(dataset);
auto iter = query.cbegin();
auto end  = query.cend();
for (; iter != end; ++iter) {
    // ... do stuff ...
}  

Iteration is not limited to only ‘const’ records. The files themselves will not be affected, but individual records may be modified if needed.

EntireFileQuery query("foo.bam");
for (BamRecord& record : query) {
    // ok to modify 'record' here
} 

EntireFileQuery query("foo.bam");
for (const BamRecord& record : query) {
    // do stuff
}
Note
DataSets can be implicitly constructed from BAM filenames as well. Thus a single BAM file can be read through using the following:

Inherits from IQuery

Public Functions

EntireFileQuery(const PacBio::BAM::DataSet &dataset)

Creates a new EntireFileQuery, reading through the entire contents of a dataset.

Parameters
  • dataset: input data source(s)
Exceptions
  • std::runtime_error: on failure to open/read underlying BAM files.

~EntireFileQuery()
bool GetNext(BamRecord &r)

Main iteration point for record access.

Most client code should not need to use this method directly. Use iterators instead.