bio.std.hts.bam.read

BamRead type provides convenient interface for working with SAM/BAM records.

All flags, tags, and fields can be accessed and modified.

Members

Functions

assumeUnique
auto assumeUnique(R read)

Allows modification of the read in-place even if it's slice-backed.

compareCoordinates
bool compareCoordinates(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareCoordinates
bool compareCoordinates(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareCoordinates
bool compareCoordinates(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareCoordinatesAndStrand
bool compareCoordinatesAndStrand(R1 a1, R2 a2)

Comparison function for 'coordinate' sorting order (returns whether first read is 'less' than second)

compareReadNames
bool compareReadNames(R1 a1, R2 a2)

Comparison function for 'queryname' sorting order (return whether first read is 'less' than second)

compareReadNames
bool compareReadNames(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareReadNames
bool compareReadNames(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareReadNamesAndMates
bool compareReadNamesAndMates(R1 r1, R2 r2)

Comparison function for 'queryname' sorting order setting mates of the same alignments adjacent with the first mate coming before the second mate

compareReadNamesAsPicard
bool compareReadNamesAsPicard(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareReadNamesAsPicard
bool compareReadNamesAsPicard(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
compareReadNamesAsPicard
bool compareReadNamesAsPicard(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
mixedCompareReadNames
bool mixedCompareReadNames(R1 a1, R2 a2)

Comparison function for 'queryname' sorting order as in Samtools (returns whether first read is 'less' than second in a 'mixed' order, i.e. numbers inside the strings are compared by their integer value)

mixedCompareReadNames
bool mixedCompareReadNames(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
mixedCompareReadNames
bool mixedCompareReadNames(R1 a1, R2 a2)
Undocumented in source. Be warned that the author may not have intended to support it.
mixedCompareReadNamesAndMates
bool mixedCompareReadNamesAndMates(R1 r1, R2 r2)

Comparison function for 'queryname' sorting order as in Samtools setting mates of the same alignments adjacent with the first mate coming before the second mate

mixedStrCompare
int mixedStrCompare(string a, string b)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixin templates

TagStorage
mixintemplate TagStorage()

Lazy tag storage.

Structs

BamRead
struct BamRead

BAM record representation.

EagerBamRead
struct EagerBamRead(R = BamRead)

BamRead wrapper which precomputes end_position = position + basesCovered().

UniqueRead
struct UniqueRead(R)

Allows modification of the read in-place even if it's slice-backed.

Templates

isBamRead
template isBamRead(T)

Checks if T behaves like BamRead

Examples

import std.conv;
...
assert(!read.is_unmapped);              // check flag
assert(read.ref_id != -1);              // access field

int edit_distance = to!int(read["NM"]); // access tag
read["NM"] = 0;                         // modify tag
read["NM"] = null;                      // remove tag
read["NM"] = null;                      // no-op

foreach (tag, value; read)              // iterate over tags
    writeln(tag, " ", value);           // and print their keys and values

read.sequence = "AGCAGACTACGTGTGCATAC"; // sets base qualities to 255
assert(read.base_qualities[0] == 255);
read.is_unmapped = true;                // set flag
read.ref_id = -1;                       // set field

Meta