Class BamAlignmentRecord
Represent a record from a BAM or SAM file.

Defined in <seqan/bam_io.h>
Signature class BamAlignmentRecord;

Member Function Overview

Interface Function Overview

Member Variable Overview

Detailed Description

Remarks

While also used to represent SAM records, the type is called BamAlignmentRecord since the data directly reflects a BAM records (0-based positions, identify references by id, and tags are stored in BAM format.

Member Functions Detail

BamAlignmentRecord::BamAlignmentRecord();

Default constructor.

Interface Functions Detail

void bamRecordToAlignment(align, reference, record);

Construct an Align object from a BamAlignmentRecord object.

Parameters

align The Align object to create the alignment object in.
reference The string with the reference that record lies on.
record The BamAlignmentRecord to construct alignment from.

The function will resize align to have two rows. The part of the reference that the read from record aligns to will be copied to the first row and the sequence from record will be copied to the second row (and reverse-complemented if appropriate). Then, the gaps from the CIGAR string in record will be copied to align.

Example

Here is an example:

StringSet<Dna5String> references;
BamAlignment record;
// Read references and record.
Align<Dna5String> align;
if (record.rID != BamAlignmentRecord::INVALID_REFID)
    bamRecordToAlignment(align, references[record.refId], record);

void clear(record);

Clear BamAlignmentRecord.

Parameters

record The BamAlignmentRecord to clear.

Clears all strings and resets it to default initialization state.

unsigned getAlignmentLengthInRef(record);

Return the alignment length in the record's projection in the reference.

Parameters

record The BamAlignmentRecord to compute length for.

Returns

unsigned The alignment length.

See Also

bool hasFlagAllProper(record);

Return true if a BamAlignmentRecord has the "all properly aligned" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagDuplicate(record);

Return true if a BamAlignmentRecord has the "duplicate" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagFirst(record);

Return true if a BamAlignmentRecord has the "first in template" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagLast(record);

Return true if a BamAlignmentRecord has the "last in template" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagMultiple(record);

Return true if a BamAlignmentRecord has the "multiple" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagNextRC(record);

Return true if a BamAlignmentRecord has the "next reverse-complemented" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagNextUnmapped(record);

Return true if a BamAlignmentRecord has the "next unmapped" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagQCNoPass(record);

Return true if a BamAlignmentRecord has the "did not pass QC" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagRC(record);

Return true if a BamAlignmentRecord has the "reverse-complemented" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagSecondary(record);

Return true if a BamAlignmentRecord has the "secondary" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

bool hasFlagSupplementary(record);

Return true if a BamAlignmentRecord has the "supplementary" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

bool hasFlagUnmapped(record);

Return true if a BamAlignmentRecord has the "unmapped" flag set.

Parameters

record The BamAlignmentRecord to query.

Returns

bool true if the flag is set, false otherwise.

See Also

Member Variables Detail

__int32 BamAlignmentRecord::beginPos

Begin position of the alignment (0-based, INVALID_POS for '0' in SAM).

__uint16 BamAlignmentRecord::bin

The bin of the alignment, automatically computed when writing BAM.

TCigarString BamAlignmentRecord::cigar

The CIGAR string for the BAM alignment (of type String<CigarElement<> >).

__uint16 BamAlignmentRecord::flag

The flag of this mapping.

See BamFlags for flag constants and also see the hasFlag*() functions.

__uint32 BamAlignmentRecord::INVALID_LEN

Static member with invalid/sentinel reference ids (0 as in BAM/SAM).

__uint32 BamAlignmentRecord::INVALID_POS

Static member with invalid sentinel/position value (-1).

__uint32 BamAlignmentRecord::INVALID_REFID

Static member with invalid sentinel/position value (-1).

__uint8 BamAlignmentRecord::mapQ

Mapping quality (255 for '*').

__int32 BamAlignmentRecord::pNext

Position on the reference where the next fragment in this template aligns.

INVALID_POS for '*'.

CharString BamAlignmentRecord::qName

The query/read name.

Note that the reads of a template all of the same query name and are differentiated by their position and the BAM_FLAG_FIRST/BAM_FLAG_LAST flag values.

CharString BamAlignmentRecord::qual

The PHRED quality values of the sequence (as in SAM), empty for '*'.

__int32 BamAlignmentRecord::rID

ID of reference for this fragment mapping (0-based, INVALID_REFID for '*' in SAM).

__int32 BamAlignmentRecord::rNextId

The ID of the reference where the next fragment in this template aligns.

INVALID_REFID for '*'.

CharString BamAlignmentRecord::seq

The fragment sequence.

CharString BamAlignmentRecord::tags

Raw BAM tag string, use BamTagsDict for comfortable access.

__int32 BamAlignmentRecord::tLen

The inferred template size.

INVALID_LEN for '*'.