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

Implements FormattedFileRecordConcept
All Impl'd AssignableConcept, CopyConstructibleConcept, DefaultConstructibleConcept, FormattedFileRecordConcept
Defined in <seqan/bam_io.h>
Signature class BamAlignmentRecord;

Member Function Overview

Member Functions Inherited From AssignableConcept

Interface Function Overview

Interface Functions Inherited From AssignableConcept

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.

See Also

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);

Data Races

Thread safety unknown!

void clear(record);

Clear BamAlignmentRecord.

Parameters

record The BamAlignmentRecord to clear.

Clears all strings and resets it to default initialization state.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

See Also

TLength getContigLength(record, file);

Return the length of the reference contig of a BamAlignmentRecord.

Parameters

record The BamAlignmentRecord to query.
file The BamFileIn or BamFileOut where the record belongs to.

Returns

TLength The length of the reference contig. TLength is the Value type of the LengthStore. The LengthStore type can be determined using the Member metafunction for the BamIOContext in conjunction with the LengthStoreMember tag.

Data Races

Thread safety unknown!

TNameString getContigName(record, file);

Return the name of the reference contig of a BamAlignmentRecord.

Parameters

record The BamAlignmentRecord to query.
file The BamFileIn or BamFileOut where the record belongs to.

Returns

TNameString The name of the reference contig. TNameString is the Value type of the NameStore. The NameStore type can be determined using the Member metafunction for the BamIOContext in conjunction with the NameStoreMember tag.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

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.

Data Races

Thread safety unknown!

See Also

Member Variables Detail

int32_t BamAlignmentRecord::beginPos

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

uint16_t 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_t BamAlignmentRecord::flag

The flag of this mapping.

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

uint32_t BamAlignmentRecord::INVALID_LEN

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

uint32_t BamAlignmentRecord::INVALID_POS

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

uint32_t BamAlignmentRecord::INVALID_REFID

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

uint8_t BamAlignmentRecord::mapQ

Mapping quality (255 for '*').

int32_t 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_t BamAlignmentRecord::rID

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

int32_t 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_t BamAlignmentRecord::tLen

The inferred template size.

INVALID_LEN for '*'.