BamRecord

#include <pbbam/BamRecord.h>
enum PacBio::BAM::ClipType

This enum defines the modes supported by BamRecord clipping operations.

Methods like BamRecord::Clip accept Position parameters - which may be in either polymerase or reference coorindates. Using this enum as a flag indicates how the positions should be interpreted.

Values:

CLIP_NONE

No clipping will be performed.

CLIP_TO_QUERY

Clipping positions are in polymerase coordinates.

CLIP_TO_REFERENCE

Clipping positions are in genomic coordinates.

enum PacBio::BAM::RecordType

This enum defines the possible PacBio BAM record types.

See
ReadGroupInfo::ReadType

Values:

ZMW

Polymerase read.

HQREGION

High-quality region.

SUBREAD

Subread (.

CCS

Circular consensus sequence.

SCRAP

Additional sequence (barcodes, adapters, etc.)

UNKNOWN

Unknown read type.

POLYMERASE = ZMW

enum PacBio::BAM::FrameEncodingType

This enum defines the possible encoding modes used in Frames data (e.g. BamRecord::IPD or BamRecord::PulseWidth).

The LOSSY mode is the default in production output; LOSSLESS mode being used primarily for internal applications.

See
https://github.com/PacificBiosciences/PacBioFileFormats/blob/3.0/BAM.rst for more information on pulse frame encoding schemes.

Values:

LOSSY

8-bit compression (using CodecV1) of frame data

LOSSLESS

16-bit native frame data

class PacBio::BAM::BamRecord

The BamRecord class represents a PacBio BAM record.

PacBio BAM records are extensions of normal SAM/BAM records. Thus in addition to normal fields like bases, qualities, mapping coordinates, etc., tags are used extensively to annotate records with additional PacBio-specific data.

Mapping and clipping APIs are provided as well to ensure that such operations “trickle down” to all data fields properly.

See
https://samtools.github.io/hts-specs/SAMv1.pdf for more information on standard BAM data, and https://github.com/PacificBiosciences/PacBioFileFormats/blob/3.0/BAM.rst for more information on PacBio BAM fields.

Subclassed by PacBio::BAM::VirtualZmwBamRecord

Constructors & Related Methods

BamRecord()
BamRecord(BamHeader header)
BamRecord(BamRecordImpl impl)
BamRecord(const BamRecord &other)
BamRecord(BamRecord &&other)
BamRecord &operator=(const BamRecord &other)
BamRecord &operator=(BamRecord &&other)
virtual ~BamRecord()

General Data

std::string FullName() const

Return
this record’s full name
See
BamRecordImpl::Name

BamHeader Header() const

Return
shared pointer to this record’s associated BamHeader

int32_t HoleNumber() const

Return
ZMW hole number
Exceptions
  • if: missing zm tag & record name does not contain hole number

PacBio::BAM::LocalContextFlags LocalContextFlags() const

Return
this record’s LocalContextFlags

std::string MovieName() const

Return
this record’s movie name

int32_t NumPasses() const

Return
“number of complete passes of the insert”

Position QueryEnd() const

Return
the record’s query end position, or Sequence().length() if not stored
Note
QueryEnd is in polymerase read coordinates, NOT genomic coordinates.

Position QueryStart() const

Return
the record’s query start position, or 0 if not stored
Note
QueryStart is in polymerase read coordinates, NOT genomic coordinates.

Accuracy ReadAccuracy() const

Return
this record’s expected read accuracy [0, 1000]

ReadGroupInfo ReadGroup() const

Return
ReadGroupInfo object for this record

std::string ReadGroupId() const

Return
string ID of this record’s read group
See
ReadGroupInfo::Id

int32_t ReadGroupNumericId() const

Return
integer value for this record’s read group ID

VirtualRegionType ScrapRegionType() const

Return
this scrap record’s scrap region type

ZmwType ScrapZmwType() const

Return
this scrap record’s scrap ZMW type

std::vector<float> SignalToNoise() const

Return
this record’s average signal-to-noise for each of A, C, G, and T

RecordType Type() const

Return
this record’s type
See
RecordType

BamRecord &HoleNumber(const int32_t holeNumber)

Sets this record’s ZMW hole number.

Return
reference to this record
Parameters
  • holeNumber:

BamRecord &LocalContextFlags(const PacBio::BAM::LocalContextFlags flags)

Sets this record’s local context flags.

Return
reference to this record
Parameters
  • flags:

BamRecord &NumPasses(const int32_t numPasses)

Sets this record’s “number of complete passes of the insert”.

Return
reference to this record
Parameters
  • numPasses:

BamRecord &QueryEnd(const PacBio::BAM::Position pos)

Sets this record’s query end position.

Note
Changing this will modify the name of non-CCS records.
Return
reference to this record
Parameters
  • pos:

BamRecord &QueryStart(const PacBio::BAM::Position pos)

Sets this record’s query start position.

Note
Changing this will modify the name of non-CCS records.
Return
reference to this record
Parameters
  • pos:

BamRecord &ReadAccuracy(const Accuracy &accuracy)

Sets this record’s expected read accuracy [0, 1000].

Return
reference to this record
Parameters
  • accuracy:

BamRecord &ReadGroup(const ReadGroupInfo &rg)

Attaches this record to the provided read group, changing the record name & ‘RG’ tag.

Return
reference to this record
Parameters
  • rg:

BamRecord &ReadGroupId(const std::string &id)

Attaches this record to the provided read group, changing the record name & ‘RG’ tag.

Return
reference to this record
Parameters
  • id:

BamRecord &ScrapRegionType(const VirtualRegionType type)

Sets this scrap record’s ScrapRegionType.

Return
reference to this record
Parameters
  • type:

BamRecord &ScrapRegionType(const char type)

Sets this scrap record’s ScrapRegionType.

Return
reference to this record
Parameters
  • type: character equivalent of VirtualRegionType

BamRecord &ScrapZmwType(const ZmwType type)

Sets this scrap record’s ScrapZmwType.

Return
reference to this record
Parameters
  • type:

BamRecord &ScrapZmwType(const char type)

Sets this scrap record’s ScrapZmwType.

Return
reference to this record
Parameters
  • type: character equivalent of ZmwType

BamRecord &SignalToNoise(const std::vector<float> &snr)

Sets this record’s average signal-to-noise in each of A, C, G, and T.

Return
reference to this record
Parameters
  • snr: average signal-to-noise of A, C, G, and T (in this order)

Mapping Data

Position AlignedEnd() const

Return
the record’s aligned end position
Note
AlignedEnd is in polymerase read coordinates, NOT genomic coordinates.

Position AlignedStart() const

Return
the record’s aligned start position
Note
AlignedStart is in polymerase read coordinates, NOT genomic coordinates.

Strand AlignedStrand() const

Return
the record’s strand as a Strand enum value

Cigar CigarData(bool exciseAllClips = false) const

Return
the record’s CIGAR data as a Cigar object
Parameters
  • exciseAllClips: if true, remove all clipping operations (hard & soft) [default:false]

bool IsMapped() const

Return
true if this record was mapped by aligner

uint8_t MapQuality() const

Return
this record’s mapping quality. A value of 255 indicates “unknown”

size_t NumDeletedBases() const

Return
the number of deleted bases (relative to reference)

size_t NumInsertedBases() const

Return
the number of inserted bases (relative to reference)

size_t NumMatches() const

Return
the number of matching bases (sum of ‘=’ CIGAR op lengths)

std::pair<size_t, size_t> NumMatchesAndMismatches() const

Return
a tuple containing NumMatches (first) and NumMismatches (second)

size_t NumMismatches() const

Return
the number of mismatching bases (sum of ‘X’ CIGAR op lengths)

int32_t ReferenceId() const

Return
this record’s reference ID, or -1 if unmapped.
Note
This is only a valid identifier within this BAM file

std::string ReferenceName() const

Return
this record’s reference name.
Exceptions
  • an: exception if unmapped record.

Position ReferenceEnd() const

Return
the record’s reference end position, or UnmappedPosition if unmapped
Note
ReferenceEnd is in reference coordinates, NOT polymerase read coordinates.

Position ReferenceStart() const

Return
the record’s reference start position, or UnmappedPosition if unmapped
Note
ReferenceStart is in reference coordinates, NOT polymerase read coordinates.

Barcode Data

int16_t BarcodeForward() const

Return
forward barcode id
See
HasBarcodes
Exceptions
  • std::runtime_error: if barcode data is absent or malformed.

uint8_t BarcodeQuality() const

Return
barcode call confidence (Phred-scaled posterior probability of correct barcode call)
See
HasBarcodeQuality

int16_t BarcodeReverse() const

Return
reverse barcode id
See
HasBarcodes
Exceptions
  • std::runtime_error: if barcode data is absent or malformed.

std::pair<int16_t, int16_t> Barcodes() const

Return
the forward and reverse barcode ids
See
HasBarcodes
Exceptions
  • std::runtime_error: if barcode data is absent or malformed.

BamRecord &Barcodes(const std::pair<int16_t, int16_t> &barcodeIds)

Sets this record’s barcode IDs (‘bc’ tag)

Return
reference to this record
Parameters
  • barcodeIds:

BamRecord &BarcodeQuality(const uint8_t quality)

Sets this record’s barcode quality (‘bq’ tag)

Return
reference to this record
Parameters
  • quality: Phred-scaled confidence call

Auxiliary Data Queries

bool HasAltLabelQV() const

Return
true if this record has AltLabelQV data

bool HasAltLabelTag() const

Return
true if this record has AltLabelTag data

bool HasBarcodes() const

Return
true if this record has Barcode data

bool HasBarcodeQuality() const

Return
true is this record has BarcodeQuality data

bool HasDeletionQV() const

Return
true if this record has DeletionQV data

bool HasDeletionTag() const

Return
true if this record has DeletionTag data

bool HasHoleNumber() const

Return
true if this record has a HoleNumber

bool HasInsertionQV() const

Return
true if this record has InsertionQV data

bool HasIPD() const

Return
true if this record has IPD data

bool HasLabelQV() const

Return
true if this record has LabelQV data

bool HasLocalContextFlags() const

Return
true if this record has LocalContextFlags (absent in CCS)

bool HasMergeQV() const

Return
true if this record has MergeQV data

bool HasNumPasses() const

Return
true if this record has NumPasses data

bool HasPkmean() const

Return
true if this record has Pkmean data

bool HasPkmid() const

Return
true if this record has Pkmid data

bool HasPkmean2() const

Return
true if this record has Pkmean2 data

bool HasPkmid2() const

Return
true if this record has Pkmid2 data

bool HasPreBaseFrames() const

Return
true if this record has PreBaseFrames aka IPD data

bool HasPrePulseFrames() const

Return
true if this record has PrePulseFrames data

bool HasPulseCall() const

Return
true if this record has PulseCall data

bool HasPulseCallWidth() const

Return
true if this record has PulseCallWidth data

bool HasPulseExclusion(void) const

Return
true if this record has PulseExclusion data

bool HasPulseMergeQV() const

Return
true if this record has PulseMergeQV data

bool HasPulseWidth() const

Return
true if this record has PulseWidth data

bool HasReadAccuracy() const

Return
true if this record has ReadAccuracyTag data

bool HasQueryEnd() const

Return
true if this record has QueryEnd data

bool HasQueryStart() const

Return
true if this record has QueryStart data

bool HasScrapRegionType() const

Return
true if this record has ScrapRegionType data (only in SCRAP)

bool HasScrapZmwType() const

Return
true if this record has scrap ZMW type data (only in SCRAP)

bool HasSignalToNoise() const

Return
true if this record has signal-to-noise data (absent in POLYMERASE)

bool HasStartFrame() const

Return
true if this record has StartFrame data

bool HasSubstitutionQV() const

Return
true if this record has SubstitutionQV data

bool HasSubstitutionTag() const

Return
true if this record has SubstitutionTag data

Sequence & Tag Data

std::string AltLabelTag(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s AltLabelTag values (“pt” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new gap chars will be ‘-‘ and padding chars will be ‘*’.
Return
AltLabelTags string
Parameters
  • orientation: Orientation of output.

std::string DeletionTag(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s DeletionTag values (“dt” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new gap chars will be ‘-‘ and padding chars will be ‘*’.
Return
DeletionTag string
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

std::string Sequence(const Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s DNA sequence (SEQ field).

Note
If aligned is true, and gaps/padding need to be inserted, the new gap chars will be ‘-‘ and padding chars will be ‘*’.
Return
sequence string
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

std::string SubstitutionTag(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s SubstitutionTag values (“st” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new gap chars will be ‘-‘ and padding chars will be ‘*’.
Return
SubstitutionTags string
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

BamRecord &AltLabelTag(const std::string &tags)

Sets this record’s AltLabelTag values (“at” tag).

Return
reference to this record
Parameters
  • tags:

BamRecord &DeletionTag(const std::string &tags)

Sets this record’s DeletionTag values (“dt” tag).

Return
reference to this record
Parameters
  • tags:

BamRecord &SubstitutionTag(const std::string &tags)

Sets this record’s SubstitutionTag values (“st” tag).

Return
reference to this record
Parameters
  • tags:

Quality Data

QualityValues AltLabelQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s AltLabelQV values (“pv” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
AltLabelQV as QualityValues object
Parameters
  • orientation: Orientation of output.

QualityValues DeletionQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s DeletionQV values (“dq” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
DeletionQV as QualityValues object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

QualityValues InsertionQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s InsertionQV values (“iq” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
InsertionQVs as QualityValues object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

QualityValues LabelQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s LabelQV values (“pq” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
LabelQV as QualityValues object
Parameters
  • orientation: Orientation of output.

QualityValues MergeQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s MergeQV values (“mq” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
MergeQV as QualityValues object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

QualityValues Qualities(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s BAM quality values (QUAL field).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
BAM qualities as QualityValues object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

QualityValues SubstitutionQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s SubstitutionQV values (“sq” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new QVs will have a value of 0.
Return
SubstitutionQV as QualityValues object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

BamRecord &AltLabelQV(const QualityValues &altLabelQVs)

Sets this record’s AltLabelQV values (“pv” tag).

Return
reference to this record
Parameters
  • altLabelQVs:

BamRecord &DeletionQV(const QualityValues &deletionQVs)

Sets this record’s DeletionQV values (“dq” tag).

Return
reference to this record
Parameters
  • deletionQVs:

BamRecord &InsertionQV(const QualityValues &insertionQVs)

Sets this record’s InsertionQV values (“iq” tag).

Return
reference to this record
Parameters
  • insertionQVs:

BamRecord &LabelQV(const QualityValues &labelQVs)

Sets this record’s LabelQV values (“pq” tag).

Return
reference to this record
Parameters
  • labelQVs:

BamRecord &MergeQV(const QualityValues &mergeQVs)

Sets this record’s MergeQV values (“mq” tag).

Return
reference to this record
Parameters
  • mergeQVs:

BamRecord &SubstitutionQV(const QualityValues &substitutionQVs)

Sets this record’s SubstitutionQV values (“sq” tag).

Return
reference to this record
Parameters
  • substitutionQVs:

Pulse Data

const float photonFactor
Frames IPD(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s IPD values (“ip” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new frames will have a value of 0;
Return
IPD as Frames object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

Frames IPDRaw(Orientation orientation = Orientation::NATIVE) const

Fetches this record’s IPD values (“ip” tag), but does not upscale.

Return
IPD as Frames object
Parameters
  • orientation: Orientation of output.

std::vector<float> Pkmean(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s Pkmean values (“pa” tag).

Return
Pkmean as vector<float> object
Parameters
  • orientation: Orientation of output.

std::vector<float> Pkmid(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s Pkmid values (“pm” tag).

Return
Pkmid as vector<float> object
Parameters
  • orientation: Orientation of output.

std::vector<float> Pkmean2(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s Pkmean2 values (“pi” tag).

Return
Pkmean as vector<float> object
Parameters
  • orientation: Orientation of output.

std::vector<float> Pkmid2(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s Pkmid2 values (“ps” tag).

Return
Pkmid as vector<float> object
Parameters
  • orientation: Orientation of output.

Frames PreBaseFrames(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s PreBaseFrames aka IPD values (“ip” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new frames will have a value of 0;
Return
IPD as Frames object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

Frames PrePulseFrames(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s PrePulseFrames values (“pd” tag).

Return
PrePulseFrames as Frames object
Parameters
  • orientation: Orientation of output.

std::string PulseCall(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s PulseCall values (“pc” tag).

Return
PulseCalls string
Parameters
  • orientation: Orientation of output.

Frames PulseCallWidth(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s PulseCallWidth values (“px” tag).

Return
PulseCallWidth as Frames object
Parameters
  • orientation: Orientation of output.

std::vector<PacBio::BAM::PulseExclusionReason> PulseExclusionReason(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s PulseExclusionReason values (“pe” tag).

Return
vector of pulse exclusion reason value

QualityValues PulseMergeQV(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetch this record’s PulseMergeQV values (“pg” tag).

Return
PulseMergeQV as QualityValues object
Parameters
  • orientation: Orientation of output.

Frames PulseWidth(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s PulseWidth values (“pw” tag).

Note
If aligned is true, and gaps/padding need to be inserted, the new frames will have a value of 0.
Return
PulseWidths as Frames object
Parameters
  • orientation: Orientation of output.
  • aligned: if true, gaps/padding will be inserted, per Cigar info.
  • exciseSoftClips: if true, any soft-clipped positions will be removed from query ends

Frames PulseWidthRaw(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false) const

Fetches this record’s PulseWidth values (“pw” tag), but does not upscale.

Return
PulseWidth as Frames object
Parameters
  • orientation: Orientation of output.

std::vector<uint32_t> StartFrame(Orientation orientation = Orientation::NATIVE, bool aligned = false, bool exciseSoftClips = false, PulseBehavior pulseBehavior = PulseBehavior::ALL) const

Fetches this record’s StartFrame values (“sf” tag).

Return
StartFrame as uint32_t vector
Parameters
  • orientation: Orientation of output

BamRecord &IPD(const Frames &frames, const FrameEncodingType encoding)

Sets this record’s IPD values (“ip” tag).

Return
reference to this record
Parameters
  • frames:
  • encoding: specify how to encode the data (8-bit lossy, or 16-bit lossless)

BamRecord &Pkmean(const std::vector<float> &photons)

Sets this record’s Pkmean values (“pm” tag).

Return
reference to this record
Parameters
  • photons:

BamRecord &Pkmean(const std::vector<uint16_t> &encodedPhotons)

Sets this record’s Pkmean values (“pm” tag).

Return
reference to this record
Parameters
  • encodedPhotons:

BamRecord &Pkmid(const std::vector<float> &photons)

Sets this record’s Pkmid values (“pa” tag).

Return
reference to this record
Parameters
  • photons:

BamRecord &Pkmid(const std::vector<uint16_t> &encodedPhotons)

Sets this record’s Pkmid values (“pa” tag).

Return
reference to this record
Parameters
  • encodedPhotons:

BamRecord &Pkmean2(const std::vector<float> &photons)

Sets this record’s Pkmean2 values (“ps” tag).

Return
reference to this record
Parameters
  • photons:

BamRecord &Pkmean2(const std::vector<uint16_t> &encodedPhotons)

Sets this record’s Pkmean2 values (“ps” tag).

Return
reference to this record
Parameters
  • encodedPhotons:

BamRecord &Pkmid2(const std::vector<float> &photons)

Sets this record’s Pkmid2 values (“pi” tag).

Return
reference to this record
Parameters
  • photons:

BamRecord &Pkmid2(const std::vector<uint16_t> &encodedPhotons)

Sets this record’s Pkmid2 values (“pi” tag).

Return
reference to this record
Parameters
  • encodedPhotons:

BamRecord &PreBaseFrames(const Frames &frames, const FrameEncodingType encoding)

Sets this record’s PreBaseFrames aka IPD values (“ip” tag).

Return
reference to this record
Parameters
  • frames:
  • encoding: specify how to encode the data (8-bit lossy, or 16-bit lossless)

BamRecord &PrePulseFrames(const Frames &frames, const FrameEncodingType encoding)

Sets this record’s PrePulseFrames values (“pd” tag).

Return
reference to this record
Parameters
  • frames:
  • encoding: specify how to encode the data (8-bit lossy, or 16-bit lossless)

BamRecord &PulseCall(const std::string &tags)

Sets this record’s PulseCall values (“pc” tag).

Return
reference to this record
Parameters
  • tags:

BamRecord &PulseCallWidth(const Frames &frames, const FrameEncodingType encoding)

Sets this record’s PulseCallWidth values (“px” tag).

Return
reference to this record
Parameters
  • frames:
  • encoding: specify how to encode the data (8-bit lossy, or 16-bit lossless)

BamRecord &PulseExclusionReason(const std::vector<PacBio::BAM::PulseExclusionReason> &reasons)

\brief Sets this record’s PulseExclusionReason values (“pe” tag).

Return
reference to this record
Parameters
  • reasons:

BamRecord &PulseMergeQV(const QualityValues &pulseMergeQVs)

Sets this record’s PulseMergeQV values (“pg” tag).

Return
reference to this record
Parameters
  • pulseMergeQVs:

BamRecord &PulseWidth(const Frames &frames, const FrameEncodingType encoding)

Sets this record’s PulseWidth values (“pw” tag).

Return
reference to this record
Parameters
  • frames:
  • encoding: specify how to encode the data (8-bit lossy, or 16-bit lossless)

BamRecord &StartFrame(const std::vector<uint32_t> &startFrame)

Sets this record’s StartFrame values (“sf” tag).

Return
reference to this record
Parameters
  • startFrame:

static std::vector<uint16_t> EncodePhotons(const std::vector<float> &data)

Low-Level Access & Operations

const BamRecordImpl &Impl() const

Warning
This method should be considered temporary and avoided as much as possible. Direct access to the internal object is likely to disappear as BamRecord interface matures.
Return
const reference to underlying BamRecordImpl object

BamRecordImpl &Impl()

Warning
This method should be considered temporary and avoided as much as possible. Direct access to the internal object is likely to disappear as BamRecord interface matures.
Return
reference to underlying BamRecordImpl object

void ResetCachedPositions() const

Resets cached aligned start/end.

Note
This method should not be needed in most client code. It exists primarily as a hook for internal reading loops (queries, index build, etc.) It’s essentially a workaround and will likely be removed from the API.

void ResetCachedPositions()

Resets cached aligned start/end.

Note
This method should not be needed in most client code. It exists primarily as a hook for internal reading loops (queries, index build, etc.) It’s essentially a workaround and will likely be removed from the API.

void UpdateName()

Updates the record’s name (BamRecord::FullName) to reflect modifications to name components (movie name, ZMW hole number, etc.)

Clipping & Mapping

BamRecord &Clip(const ClipType clipType, const PacBio::BAM::Position start, const PacBio::BAM::Position end)

Applies clipping to this record.

BamRecord Clipped(const ClipType clipType, const PacBio::BAM::Position start, const PacBio::BAM::Position end) const

Creates a copied record from this one, with clipping applied.

BamRecord &Map(const int32_t referenceId, const Position refStart, const Strand strand, const Cigar &cigar, const uint8_t mappingQuality)

Applies mapping to this record.

BamRecord Mapped(const int32_t referenceId, const Position refStart, const Strand strand, const Cigar &cigar, const uint8_t mappingQuality) const

Creates a copied record from this one, with mapping applied.

static BamRecord Clipped(const BamRecord &input, const ClipType clipType, const PacBio::BAM::Position start, const PacBio::BAM::Position end)

Creates a copied record from input, with clipping applied.

static BamRecord Mapped(const BamRecord &input, const int32_t referenceId, const Position refStart, const Strand strand, const Cigar &cigar, const uint8_t mappingQuality)

Creates a copied record from input, with mapping applied.

Public Members

BamHeader header_

public & mutable so that queries can directly set the header info, even on a record that is const from client code’s perspective

Friends

friend PacBio::BAM::BamRecord::internal::BamRecordMemory