BamRecordBuilder

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

The BamRecordBuilder class provides a helper utility for building BamRecords.

This class provides a mechanism for building up BAM data and lazy-encoding/constructing the actual BamRecord. Currently, the methods here really only support filling in the low-level SAM/BAM-style fields, not so much the PacBio-specific fields.

Constructors & Related Methods

BamRecordBuilder()

Creates an empty BAM record builder.

BamRecordBuilder(BamHeader header)

Creates an empty BAM record builder, with header info to apply to built records.

Parameters

BamRecordBuilder(const BamRecord &prototype)

Creates record builder with inital record data.

Parameters
  • prototype: data from this record will be used to seed the builder

BamRecordBuilder(const BamRecordBuilder &other)
BamRecordBuilder(BamRecordBuilder &&other)
BamRecordBuilder &operator=(const BamRecordBuilder &other)
BamRecordBuilder &operator=(BamRecordBuilder &&other)
~BamRecordBuilder()

Record-Building

BamRecord Build() const

Builds a BamRecord from current builder attributes.

Return
newly-built BamRecord object

bool BuildInPlace(BamRecord &record) const

Replaces an existing BamRecord‘s data with current builder attributes.

Return
true if successful
Parameters
  • record: resulting record

void Reset()

Resets builder attributes to default values.

void Reset(const BamRecord &prototype)

Resets builder attributes with prototype's data.

Parameters
  • prototype:

void Reset(BamRecord &&prototype)

Resets builder attributes with prototype's data.

Parameters
  • prototype:

Core Attribute Setup

BamRecordBuilder &Bin(const uint32_t bin)

Sets the record’s (BAI) index bin ID.

Return
reference to this builder
Parameters
  • bin: BAI index bin ID.

BamRecordBuilder &Flag(const uint32_t flag)

Sets this record’s alignment flag, using a raw integer.

Return
reference to this record
Parameters
  • flag: raw alignment flag

BamRecordBuilder &InsertSize(const int32_t iSize)

Sets this record’s insert size.

Return
reference to this record
Parameters
  • iSize: insert size

BamRecordBuilder &MapQuality(const uint8_t mapQual)

Sets this record’s map quality.

Return
reference to this record
Parameters
  • mapQual: mapping quality - value of 255 indicates “unknown”

BamRecordBuilder &MatePosition(const int32_t pos)

Sets this record’s mate’s mapped position.

Return
reference to this record
Parameters
  • pos: mapped position. A value of -1 indicates unmapped.

BamRecordBuilder &MateReferenceId(const int32_t id)

Sets this record’s mate’s mapped reference ID.

Return
reference to this record
Parameters
  • id: reference ID. A value of -1 indicates unmapped.

BamRecordBuilder &Position(const int32_t pos)

Sets this record’s mapped position.

Return
reference to this record
Parameters
  • pos: mapped position. A value of -1 indicates unmapped.

BamRecordBuilder &ReferenceId(const int32_t id)

Sets this record’s mapped reference ID.

Return
reference to this record
Parameters
  • id: reference ID. A value of -1 indicates unmapped.

Alignment Flag Setup

BamRecordBuilder &SetDuplicate(bool ok)

Sets whether this record is a PCR/optical duplicate.

BamRecordBuilder &SetFailedQC(bool ok)

Sets whether this record failed quality controls.

BamRecordBuilder &SetFirstMate(bool ok)

Sets whether this record is the first mate of a pair.

BamRecordBuilder &SetMapped(bool ok)

Sets whether this record was aligned.

BamRecordBuilder &SetMateMapped(bool ok)

Sets whether this record’s mate was aligned.

BamRecordBuilder &SetMateReverseStrand(bool ok)

Sets whether this record’s mate mapped to reverse strand.

BamRecordBuilder &SetPaired(bool ok)

Sets whether this record came from paired-end sequencing.

BamRecordBuilder &SetPrimaryAlignment(bool ok)

Sets whether this record is a read’s primary alignment.

BamRecordBuilder &SetProperPair(bool ok)

Sets whether this record & its mate were properly mapped, per the aligner.

BamRecordBuilder &SetReverseStrand(bool ok)

Sets whether this record mapped to reverse strand.

BamRecordBuilder &SetSecondMate(bool ok)

Sets whether this record is the second mate of a pair.

BamRecordBuilder &SetSupplementaryAlignment(bool ok)

Sets whether this record is a supplementary alignment.

Variable-Length Data Setup

BamRecordBuilder &Cigar(const PacBio::BAM::Cigar &cigar)

Sets the record’s CIGAR data.

Return
reference to this builder

BamRecordBuilder &Cigar(PacBio::BAM::Cigar &&cigar)

Sets the record’s CIGAR data.

Return
reference to this builder

BamRecordBuilder &Name(const std::string &name)

Sets the record’s name.

Return
reference to this builder

BamRecordBuilder &Name(std::string &&name)

Sets the record’s name.

Return
reference to this builder

BamRecordBuilder &Qualities(const std::string &qualities)

Sets the record’s qualities.

Return
reference to this builder

BamRecordBuilder &Qualities(std::string &&qualities)

Sets the record’s qualities.

Return
reference to this builder

BamRecordBuilder &Sequence(const std::string &sequence)

Sets the record’s sequence.

Return
reference to this builder

BamRecordBuilder &Sequence(std::string &&sequence)

Sets the record’s sequence.

Return
reference to this builder

BamRecordBuilder &Tags(const TagCollection &tags)

Sets the record’s tags.

Return
reference to this builder

BamRecordBuilder &Tags(TagCollection &&tags)

Sets the record’s tags.

Return
reference to this builder