OrderedLookup

#include <pbbam/PbiLookupData.h>
template <typename T>
class PacBio::BAM::OrderedLookup

The OrderedLookup class provides a quick lookup structure for PBI index data, where key values are sorted.

The main, underlying lookup structure is essentailly a std::map, where the key is some value (e.g. readAccuracy) and the value is the list of indices (i-th record) in the BAM file.

This lookup class is one of the main building blocks for the PBI index lookup components.

Parameters
  • T: type of key stored (Accuracy for readAccuracy, int32_t for ZMW, etc.)

Constructors & Related Methods

OrderedLookup()

Creates an empty OrderedLookup structure.

OrderedLookup(const container_type &data)

Creates an OrderedLookup struture, from another’s underlying lookup container.

Parameters
  • data: lookup data container

OrderedLookup(container_type &&data)

Creates an OrderedLookup struture, from another’s underlying lookup container.

Parameters
  • data: lookup data container

OrderedLookup(const std::vector<T> &rawData)

Creates an OrderedLookup struture, from raw data.

Parameters
  • rawData: raw data values, where i is the index into the BAM file, and rawData[i] is the key value

OrderedLookup(std::vector<T> &&rawData)

Creates an OrderedLookup struture, from raw data.

Parameters
  • rawData: raw data values, where i is the index into the BAM file, and rawData[i] is the key value

Operators

bool operator==(const OrderedLookup<T> &other) const

Return
true if this lookup is same as other

bool operator!=(const OrderedLookup<T> &other) const

Return
true if this lookup is not the same as other

STL-Compatibility Methods

iterator begin()

Return
an iterator to the first element in the underlying container

const_iterator begin() const

Return
a const iterator to the first element in the underlying container

const_iterator cbegin() const

Return
a const iterator to the first element in the underlying

iterator end()

Return
an iterator after the last element in the underlying container

const_iterator end() const

Return
a const iterator after the last element in the underlying container

const_iterator cend() const

Return
a const iterator after the last element in the underlying container

bool empty() const

Return
true if underlying container is empty

size_t size() const

Return
number of keys in the container

Lookup Data

IndexList LookupIndices(const key_type &key, const Compare::Type &compare) const

Performs a lookup into the underlying data.

Return
sorted list of unique indices that satisfy the lookup key & compare type
Parameters
  • key: key value to lookup
  • compare: compare type

std::vector<T> Unpack() const

Converts the lookup structure back into its raw data.

Return
raw data values, where i is the index into the BAM file, and rawData[i] is the key value

Public Types

template<>
using key_type = T
template<>
using value_type = IndexList
template<>
using container_type = std::map<key_type, value_type>
template<>
using iterator = typename container_type::iterator
template<>
using const_iterator = typename container_type::const_iterator