The class for iterating reference bases together with reads overlapping them.
Tracks current reference base
Creates a pileup range from a range of reads. Note that all reads must be aligned to the same reference.
This function constructs range of non-overlapping consecutive pileups from a range of reads so that these pileups can be processed in parallel.
Allows to express the intention clearer.
Abstract pileup structure. S is type of column range.
Represents a single pileup column
Represents a read aligned to a column
import bio.bam.reader, bio.bam.pileup, std.stdio, std.algorithm : count; void main() { auto bam = new BamReader("file.bam"); // assume single reference and MD tags auto pileup = bam.reads().makePileup(useMD); foreach (column; pileup) { auto matches = column.bases.count(column.reference_base); if (matches < column.coverage * 2 / 3) writeln(column.position); // print positions of possible mismatches } }
This module is used for iterating over columns of alignment.
The function makePileup is called on a range of coordinate-sorted reads mapped to the same reference. It returns an input range of columns.
This returned range can then be iterated with foreach. First column is located at the same position on the reference, as the first base of the first read.
Each popFront operation advances current position on the reference. The default behaviour is to exclude sites with zero coverage from the iteration.
Each column keeps set of reads that overlap corresponding position on the reference. If reads contain MD tags, and makePileup was asked to use them, reference base at the column is also available.
Each read preserves all standard read properties but also keeps column-related information, namely <ul>
</ul>
It is clear from the above that current CIGAR operation cannot be an insertion. The following are suggested ways to check for them: <ul>
</ul>