SubreadLengthQuery

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

The SubreadLengthQuery class provides iterable access to a DataSet‘s BAM records, limiting results to those matching a subread length criterion.

Example:

// using C++11 range-based for loop
SubreadLengthQuery query(500, Compare::GREATER_THAN_EQUAL, dataset);
for (const BamRecord& r : query) {
    assert((r.QueryEnd() - r.QueryStart()) >= 500);  
}

// OR

// using iterators directly
SubreadLengthQuery query(500, Compare::GREATER_THAN_EQUAL, dataset);
auto iter = query.cbegin();
auto end  = query.cend();
for (; iter != end; ++iter) {
    assert((iter->QueryEnd() - iter->QueryStart()) >= 500);
} 

Note
Currently, all BAM files must have a corresponding ”.pbi” index file. Use BamFile::EnsurePacBioIndexExists before creating the query if one may not be present.

Inherits from IQuery

Public Functions

SubreadLengthQuery(const int32_t length, const Compare::Type compareType, const DataSet &dataset)

Creates a new SubreadLengthQuery, limiting record results to only those matching a subread length criterion.

Parameters
  • length: subread length value
  • compareType: compare operator
  • dataset: input data source(s)
Exceptions
  • std::runtime_error: on failure to open/read underlying BAM or PBI files.

~SubreadLengthQuery()
bool GetNext(BamRecord &r)

Main iteration point for record access.

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

uint32_t NumReads() const